public int CreateTimeline( string timelineName, Color color, TimelineSampleSourceDelegate source = null) { return(this.CreateTimeline(timelineName, "Default", color, source)); }
public int CreateTimeline( string timelineName, string chartName, Color color, TimelineSampleSourceDelegate source = null, float?verticalScale = null, float?sampleHistory = null) { var chart = this.charts.GetOrInit(chartName); // Vertical scale. var verticalScaleToUse = verticalScale ?? this.defaultVerticalScale; chart.Config.VerticalScale = verticalScaleToUse; chart.Config.VerticalMarkers = chart.Config.VerticalScale / 2f; // Sample history time. var sampleHistoryTime = sampleHistory ?? this.defaultSampleHistoryTime; chart.SampleHistoryTime = sampleHistoryTime; chart.Config.HorizontalScale = chart.SampleHistoryTime; chart.Config.HorizontalMarkers = chart.Config.HorizontalScale / 4f; var newId = this.GetNextTimelineId(); var timeline = new TimelineInfo(newId, timelineName) { SampleSource = source, Color = color, Chart = chart }; chart.Timelines[newId] = timeline; this.timelineChartMap[newId] = chart; this.Log(string.Format("Created timeline {0}", timeline), this.loggingEnabled); // Initialise the samples with zeros to make chart drawing simpler. // var numSamples = chart.GetSampleHistorySize(); // for (var i=0; i < numSamples; i++) // timeline.Samples.Enqueue(0f); return(newId); }
public void RegisterSampleSource(int timelineId, TimelineSampleSourceDelegate source) { var timeline = this.GetTimeline(timelineId); timeline.SampleSource = source; }