private void plotData(Collection <StockData> list, Brush pen, String Description, ChartPlotter graph) { if (propertyChanger.Graphs.Any(x => x.Description.Full.Equals(Description))) { return; } IPointDataSource point = null; LineGraph line; EnumerableDataSource <StockData> _edsSPP; _edsSPP = new EnumerableDataSource <StockData>(list); _edsSPP.SetXMapping(p => dateAxis.ConvertToDouble(p.date)); _edsSPP.SetYMapping(p => p.value); point = _edsSPP; line = new LineGraph(point); line.LinePen = new Pen(pen, 2); line.Description = new PenDescription(Description); line.Visibility = Visibility.Hidden; propertyChanger.Graphs.Add(line); graph.Children.Add(line); graph.FitToView(); }
/// <summary> /// Adds one dimensional graph. /// </summary> /// <param name="pointSource">The point source.</param> /// <param name="description">The description.</param> /// <returns></returns> public static LineGraph AddLineGraph(this Plotter2D plotter, IPointDataSource pointSource, string description) { LineGraph graph = AddLineGraph(plotter, pointSource); graph.Description = new PenDescription(description); return(graph); }
public static LineGraph AddLineGraph(this Plotter2D plotter, IPointDataSource pointSource, Pen linePen, Description description) { if (pointSource == null) { throw new ArgumentNullException("pointSource"); } if (linePen == null) { throw new ArgumentNullException("linePen"); } LineGraph graph = new LineGraph { DataSource = pointSource, LinePen = linePen }; if (description != null) { NewLegend.SetDescription(graph, description.Brief); graph.Description = description; } // graph.Filters.Add(new InclinationFilter()); graph.Filters.Add(new FrequencyFilter()); plotter.Children.Add(graph); return(graph); }
private void DetachDataSource(IPointDataSource source) { if (source != null) { source.DataChanged -= OnDataChanged; } }
public bool Tap(CGPoint tapContentLocation, IChartView chartView, IPointDataSource pointDataSource, IPointHighlightHandler highlightHandler, IXAxis xAxis, IYAxis yAxis) { double sourcePositionStart = xAxis.GetSourceValue(tapContentLocation.X - TapDistance); var sourcePositionEnd = xAxis.GetSourceValue(tapContentLocation.X + TapDistance); var entriesInTapRange = pointDataSource .GetEntriesInRange(sourcePositionStart, sourcePositionEnd) .Select((IPointEntry entry) => new { Entry = entry, Distance = GetDistance(tapContentLocation, entry, xAxis, yAxis) }) .Where((t) => t.Distance <= TapDistance) .OrderBy(p => p.Distance); var entryNearestToTap = entriesInTapRange.FirstOrDefault(); if (entryNearestToTap != null) { highlightHandler.TapOnEntries(Multiselect ? entriesInTapRange.Select(t => t.Entry) : new List <IPointEntry> { entryNearestToTap.Entry }); } else { highlightHandler.TapOnNoEntry(); } return(entryNearestToTap != null); }
/// <summary> /// 显示曲线图表 /// </summary> /// <param name="vm"></param> private void ShowCurve(WeightCurveViewModel vm) { DateTime[] dates = (from r in vm.WeightCurveDataList select DateTime.Parse(r.recordtime)).ToArray(); decimal[] weightList = (from r in vm.WeightCurveDataList select r.recorddata).ToArray(); var xDataSource = new EnumerableDataSource <DateTime>(dates); xDataSource.SetXMapping(x => dateAxis.ConvertToDouble(x)); var yDataSource = new EnumerableDataSource <decimal>(weightList); yDataSource.SetYMapping(y => Convert.ToDouble(y)); yDataSource.AddMapping(ShapeElementPointMarker.ToolTipTextProperty, Y => String.Format("{0}", Y)); ds = new CompositeDataSource(xDataSource, yDataSource); plotter.Children.RemoveAll(typeof(LineGraph)); plotter.Children.RemoveAll(typeof(MarkerPointsGraph)); plotter.Children.RemoveAll(typeof(ElementMarkerPointsGraph)); plotter.Children.RemoveAll(typeof(Microsoft.Research.DynamicDataDisplay.Charts.Navigation.CursorCoordinateGraph)); chart = plotter.AddLineGraph(ds, new Pen(Brushes.LimeGreen, 2), new CircleElementPointMarker { Size = 5, Brush = Brushes.Red, Fill = Brushes.Orange, Pen = new Pen(Brushes.Blue, 5) }, new PenDescription("重量曲线")); plotter.Children.Add(new CursorCoordinateGraph()); plotter.FitToView(); }
/// <summary> /// Adds one dimensional graph. /// </summary> /// <param name="pointSource">The point source.</param> /// <param name="description">The description.</param> /// <returns></returns> public static LineGraph AddLineGraph(this Plotter2D plotter, IPointDataSource pointSource, string description) { LineGraph graph = AddLineGraph(plotter, pointSource); graph.Description = new PenDescription(description); NewLegend.SetDescription(graph, description); return graph; }
/// <summary> /// Adds data part. /// </summary> /// <param name="dataPart">The data part.</param> public void AddDataPart(IPointDataSource dataPart) { if (dataPart == null) throw new ArgumentNullException("dataPart"); dataParts.Add(dataPart); dataPart.DataChanged += OnPartDataChanged; }
private void UpdateBounds(IPointDataSource dataSource) { if (Plotter2D != null & dataSource != null) { var transform = GetTransform(); Rect bounds = BoundsHelper.GetViewportBounds(dataSource.GetPoints(), transform.DataTransform); ContentBounds = bounds; } }
/// <summary> /// Adds one dimensional graph. /// </summary> /// <param name="pointSource">The point source.</param> /// <param name="lineThickness">The line thickness.</param> /// <param name="description">The description.</param> /// <returns></returns> public static LineGraph AddLineGraph(this Plotter2D plotter, IPointDataSource pointSource, double lineThickness, string description) { var res = AddLineGraph(plotter, pointSource, new Pen(new SolidColorBrush(ColorHelper.CreateRandomHsbColor()), lineThickness), (PointMarker)null, new PenDescription(description)); return(res.LineGraph); }
private void VisitEnumerable(IPointDataSource dataSource) { var xDataPart = dataSource as EnumerableXDataSource <THorizontal>; Visit(xDataPart); var yDataPart = dataSource as EnumerableYDataSource <TVertical>; Visit(yDataPart); }
/// <summary> /// Create a linegraph using specific datasource and description /// </summary> /// <param name="pointSource">Data source</param> /// <param name="description">Description shown in legend</param> public LineGraph(IPointDataSource pointSource, string description) : this() { DataSource = pointSource; Settings = new LineGraphSettings() { Description = description }; }
private void UpdateBounds(IPointDataSource dataSource) { if (Plotter2D != null) { var transform = GetTransform(); DataRect bounds = BoundsHelper.GetViewportBounds(dataSource.GetPoints(), transform.DataTransform); Viewport2D.SetContentBounds(this, bounds); } }
/// <summary> /// Adds data part. /// </summary> /// <param name="dataPart">The data part.</param> public void AddDataPart(IPointDataSource dataPart) { if (dataPart == null) { throw new ArgumentNullException("dataPart"); } dataParts.Add(dataPart); dataPart.DataChanged += OnPartDataChanged; }
protected virtual void OnDataSourceChanged(DependencyPropertyChangedEventArgs args) { IPointDataSource newDataSource = (IPointDataSource)args.NewValue; if (newDataSource != null) { UpdateBounds(newDataSource); } Update(); }
private void Visit(IPointDataSource dataSource) { if (dataSource == null) { return; } CompositeDataSource compositeDS = dataSource as CompositeDataSource; Visit(compositeDS); VisitEnumerable(dataSource); }
protected override void OnChildAdded(IPlotterElement child) { base.OnChildAdded(child); IOneDimensionalChart chart = child as IOneDimensionalChart; if (chart != null) { chart.DataChanged += OnOneDimensionalChart_DataChanged; IPointDataSource dataSource = chart.DataSource; Visit(dataSource); } }
private void drawGraphic(List <Point> pointsOfFunction, string description) { EnumerableDataSource <Point> enumerableDataSource = new EnumerableDataSource <Point>(pointsOfFunction); enumerableDataSource.SetXMapping(u => u.X); enumerableDataSource.SetYMapping(u => u.Y); IPointDataSource iPointDataSource = enumerableDataSource; graphic.AddLineGraph(iPointDataSource, new Pen(new SolidColorBrush(Colors.Brown), 1.5), new CirclePointMarker { Size = 8.0 }, new PenDescription(description)); graphic.FitToView(); }
private void OnDataSourceReplaced(IPointDataSource prevDataSource, IPointDataSource currDataSource) { if (prevDataSource != null) { prevDataSource.DataChanged -= OnDataChanged; } if (currDataSource != null) { currDataSource.DataChanged += OnDataChanged; } Update(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { image.Source = d3dimage; Initialize(); EnumerableDataSource<double> xSrc = new EnumerableDataSource<double>(animatedX); xSrc.SetXMapping(x => x); var yDS = new EnumerableDataSource<double>(animatedY); yDS.SetYMapping(y => y); animatedDataSource = new CompositeDataSource(xSrc, yDS); timer.Interval = TimeSpan.FromMilliseconds(10); timer.Tick += new EventHandler(timer_Tick); timer.Start(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { image.Source = d3dimage; Initialize(); EnumerableDataSource <double> xSrc = new EnumerableDataSource <double>(animatedX); xSrc.SetXMapping(x => x); var yDS = new EnumerableDataSource <double>(animatedY); yDS.SetYMapping(y => y); animatedDataSource = new CompositeDataSource(xSrc, yDS); timer.Interval = TimeSpan.FromMilliseconds(10); timer.Tick += new EventHandler(timer_Tick); timer.Start(); }
public SampleLine() { EnumerableDataSource<double> xSrc = new EnumerableDataSource<double>(animatedX); xSrc.SetXMapping(x => x); var yDS = new EnumerableDataSource<double>(animatedY); yDS.SetYMapping(y => y); animatedDataSource = new CompositeDataSource(xSrc, yDS); timer.Interval = TimeSpan.FromMilliseconds(10); timer.Tick += new EventHandler(timer_Tick); timer.Start(); camera.FieldOfView = (float)(Math.PI / 4); camera.NearPlane = 0.0f; camera.FarPlane = 40.0f; camera.Location = new Vector3(0.0f, 7.0f, 20.0f); camera.Target = Vector3.Zero; }
protected virtual void OnDataSourceChanged(DependencyPropertyChangedEventArgs args) { IPointDataSource newDataSource = (IPointDataSource)args.NewValue; if (device != null) { UpdateBounds(DataSource); var vertices = from p in DataSource.GetPoints() select new VertexPosition { Vertex = new Vector3F((float)p.X, (float)p.Y, 0) }; count = vertices.Count(); vertexBuffer = BufferHelper.CreateBuffer <VertexPosition>(device, vertices.ToArray()); deviceContext.IA.SetVertexBuffers(0, new D3DBuffer[] { vertexBuffer }, new uint[] { VertexPosition.Size }, new uint[] { 0 }); Update(); } }
private void plotBuyEvent(Collection <StockData> list) { IPointDataSource point = null; CirclePointMarker marker = new CirclePointMarker(); EnumerableDataSource <StockData> _edsSPP; _edsSPP = new EnumerableDataSource <StockData>(list); _edsSPP.SetXMapping(p => dateAxis.ConvertToDouble(p.date)); _edsSPP.SetYMapping(p => p.value); point = _edsSPP; BuyMarkerGraph.DataSource = point; marker.Size = 10; marker.Fill = new SolidColorBrush(Colors.Blue); marker.Pen = new Pen(new SolidColorBrush(Colors.Black), 2.0); BuyMarkerGraph.Marker = marker; }
public void DrawPlot(CGContext context, IPointDataSource dataSource, IEnumerable <IPointEntry> highlightedEntries, IViewPort viewPort, IXAxis xAxis, IYAxis yAxis) { var visibleSourceRange = VisibleSourceXRange(xAxis, viewPort); var visibleSourceRangeStart = Math.Floor(visibleSourceRange.Item1); var visibleSourceRangeEnd = Math.Ceiling(visibleSourceRange.Item2); if (Style.BezierCurve) {//для отображения кривых нужны дополнительные точки для рассчета опорных точек //TODO учитывать масштаб visibleSourceRangeStart--; visibleSourceRangeEnd++; } var visibleEntries = dataSource.GetEntriesInRange(visibleSourceRangeStart, visibleSourceRangeEnd); Draw(context, visibleEntries, highlightedEntries, viewPort, xAxis, yAxis, Style); }
public static IEnumerable<Point> GetPoints(IPointDataSource dataSource, DependencyObject context) { if (dataSource == null) throw new ArgumentNullException("dataSource"); if (context == null) context = Context.EmptyContext; using (IPointEnumerator enumerator = dataSource.GetEnumerator(context)) { Point p = new Point(); while (enumerator.MoveNext()) { enumerator.GetCurrent(ref p); yield return p; p = new Point(); } } }
public SampleLine() { EnumerableDataSource <double> xSrc = new EnumerableDataSource <double>(animatedX); xSrc.SetXMapping(x => x); var yDS = new EnumerableDataSource <double>(animatedY); yDS.SetYMapping(y => y); animatedDataSource = new CompositeDataSource(xSrc, yDS); timer.Interval = TimeSpan.FromMilliseconds(10); timer.Tick += new EventHandler(timer_Tick); timer.Start(); camera.FieldOfView = (float)(Math.PI / 4); camera.NearPlane = 0.0f; camera.FarPlane = 40.0f; camera.Location = new Vector3(0.0f, 7.0f, 20.0f); camera.Target = Vector3.Zero; }
public TooltipSample() { InitializeComponent(); // Prepare data in arrays for (int i = 0; i < N; i++) { x[i] = i * 0.2; y[i] = Math.Cos(x[i]); } // Add data sources: yDataSource = new EnumerableDataSource<double>(y); yDataSource.SetYMapping(Y => Y); yDataSource.AddMapping(ShapeElementPointMarker.ToolTipTextProperty, Y => String.Format("Value is {0}", Y)); xDataSource = new EnumerableDataSource<double>(x); xDataSource.SetXMapping(X => X); ds = new CompositeDataSource(xDataSource, yDataSource); // adding graph to plotter // todo //chart = plotter.AddLineGraph(ds, // new Pen(Brushes.LimeGreen, 3), // new CircleElementPointMarker // { // Size = 10, // Brush = Brushes.Red, // Fill = Brushes.Orange // }, // new PenDescription("Cosine")); plotter.Children.Add(new CursorCoordinateGraph()); // Force evertyhing plotted to be visible plotter.FitToView(); }
public TooltipSample() { InitializeComponent(); // Prepare data in arrays for (int i = 0; i < N; i++) { x[i] = i * 0.2; y[i] = Math.Cos(x[i]); } // Add data sources: yDataSource = new EnumerableDataSource <double>(y); yDataSource.SetYMapping(Y => Y); yDataSource.AddMapping(ShapeElementPointMarker.ToolTipTextProperty, Y => String.Format("Value is {0}", Y)); xDataSource = new EnumerableDataSource <double>(x); xDataSource.SetXMapping(X => X); ds = new CompositeDataSource(xDataSource, yDataSource); // adding graph to plotter // todo //chart = plotter.AddLineGraph(ds, // new Pen(Brushes.LimeGreen, 3), // new CircleElementPointMarker // { // Size = 10, // Brush = Brushes.Red, // Fill = Brushes.Orange // }, // new PenDescription("Cosine")); plotter.Children.Add(new CursorCoordinateGraph()); // Force evertyhing plotted to be visible plotter.FitToView(); }
private void dataSource(List <CurrencyInfo> rates) { EnumerableDataSource <CurrencyInfo> xDataSource = new EnumerableDataSource <CurrencyInfo>(rates); EnumerableDataSource <CurrencyInfo> yDataSource = new EnumerableDataSource <CurrencyInfo>(rates); yDataSource.SetYMapping(y => y.BidPrice); yDataSource.AddMapping(ShapeElementPointMarker.ToolTipTextProperty, y => String.Format("BidPrice is {0}", y.BidPrice)); xDataSource.SetXMapping(x => x.CurrentTime); ds = new CompositeDataSource(xDataSource, yDataSource); chart = plotter.AddLineGraph(ds, new Pen(Brushes.LimeGreen, 1), new CircleElementPointMarker { Size = 5, Brush = Brushes.Red, Fill = Brushes.Orange }, new PenDescription("BidPrice")); plotter.Children.Add(new CursorCoordinateGraph()); plotter.FitToView(); }
private void OnDataSourceChanged(IPointDataSource oldDataSource, IPointDataSource currentDataSource) { if (oldDataSource != null) { oldDataSource.Changed -= OnDataSourceChangedEvent; INotifyCollectionChanged observableCollection = oldDataSource as INotifyCollectionChanged; if (observableCollection != null) { observableCollection.CollectionChanged -= observableCollection_CollectionChanged; } } if (currentDataSource != null) { currentDataSource.Changed += OnDataSourceChangedEvent; INotifyCollectionChanged observableCollection = currentDataSource as INotifyCollectionChanged; if (observableCollection != null) { observableCollection.CollectionChanged += observableCollection_CollectionChanged; } } DependencyObject oldDependencyDataSource = oldDataSource as DependencyObject; DependencyObject currentDependencyDataSource = currentDataSource as DependencyObject; hasContinousDataSource = currentDependencyDataSource != null; if (oldDependencyDataSource != null && currentDependencyDataSource == null && currentDataSource != null) { Viewport2D.SetIsContentBoundsHost(this, true); } else if (oldDependencyDataSource == null && currentDependencyDataSource != null) { Viewport2D.SetIsContentBoundsHost(this, false); } UpdateUIRepresentation(); }
public static IEnumerable <Point> GetPoints(IPointDataSource dataSource, DependencyObject context) { if (dataSource == null) { yield break; } if (context == null) { context = new DataSource2dContext(); } using (IPointEnumerator enumerator = dataSource.GetEnumerator(context)) { Point p = new Point(); while (enumerator.MoveNext()) { enumerator.GetCurrent(ref p); yield return(p); p = new Point(); } } }
private void Initialize() { this.dataTable = new DataTable(); this.dataTable.Columns.Add("t"); this.dataTable.Columns.Add("τ(t)"); for (int i = 0; i < this.data.Count; i++) { this.dataTable.Rows.Add(new TableRow()); this.dataTable.Rows[i][0] = string.Format("{0:0.000}", this.data.ElementAt(i).Key); this.dataTable.Rows[i][1] = string.Format("{0:0.0000000}", this.data.ElementAt(i).Value); } this.dataGrid.ItemsSource = this.dataTable.DefaultView; List <Point> dataPoints = new List <Point>(); foreach (var item in this.data) { dataPoints.Add(new Point(item.Key, item.Value)); } ClearLines(); EnumerableDataSource <Point> eds = new EnumerableDataSource <Point>(dataPoints); eds.SetXMapping(p => p.X); eds.SetYMapping(p => p.Y); IPointDataSource ipds = eds; LineGraph line = new LineGraph(ipds); line.LinePen = new Pen(Brushes.Black, 2); plotter.Children.Add(line); plotter.FitToView(); }
public static IEnumerable <Point> GetPoints(IPointDataSource dataSource, DependencyObject context) { if (dataSource == null) { throw new ArgumentNullException("dataSource"); } if (context == null) { context = Context.EmptyContext; } using (IPointEnumerator enumerator = dataSource.GetEnumerator(context)) { Point p = new Point(); while (enumerator.MoveNext()) { enumerator.GetCurrent(ref p); yield return(p); p = new Point(); } } }
private void dataSource1(List <Record> rates) { EnumerableDataSource <Record> xDataSource = new EnumerableDataSource <Record>(rates); EnumerableDataSource <Record> yDataSource = new EnumerableDataSource <Record>(rates); yDataSource.SetYMapping(y => y.BidPrices[0]); yDataSource.AddMapping(ShapeElementPointMarker.ToolTipTextProperty, y => String.Format("BidPrice is {0}", y.BidPrices[0])); xDataSource.SetXMapping(x => dateAxisBidP.ConvertToDouble(x.Time)); xDataSource.AddMapping(ShapeElementPointMarker.ToolTipTextProperty, x => String.Format("Time is {0}", x.Time.ToString(CultureInfo.InvariantCulture))); ds = new CompositeDataSource(xDataSource, yDataSource); chart = plotter.AddLineGraph(ds, new Pen(Brushes.LimeGreen, 3), new CircleElementPointMarker { Size = 5, Brush = Brushes.Red, Fill = Brushes.Orange }, new PenDescription("BidPrice")); plotter.Children.Add(new CursorCoordinateGraph()); //plotter.FitToView(); }
/// <summary> /// Initializes a new instance of the <see cref="MarkerPointsGraph"/> class. /// </summary> /// <param name="dataSource">The data source.</param> public ElementMarkerPointsGraph(IPointDataSource dataSource) { DataSource = dataSource; }
/// <summary> /// Initializes a new instance of the <see cref="MarkerPointsGraph"/> class. /// </summary> /// <param name="dataSource">The data source.</param> public MarkerPointsGraph(IPointDataSource dataSource) : this() { DataSource = dataSource; }
private void UpdateBounds(IPointDataSource dataSource) { if (Plotter2D != null & dataSource!=null) { var transform = GetTransform(); Rect bounds = BoundsHelper.GetViewportBounds(dataSource.GetPoints(), transform.DataTransform); ContentBounds = bounds; } }
/// <summary> /// Adds one dimensional graph. /// </summary> /// <param name="pointSource">The point source.</param> /// <param name="lineColor">Color of the line.</param> /// <param name="lineThickness">The line thickness.</param> /// <param name="description">Description of data</param> /// <returns></returns> public static LineGraph AddLineGraph(this Plotter2D plotter, IPointDataSource pointSource, Color lineColor, double lineThickness, string description) { return AddLineGraph(plotter, pointSource, new Pen(new SolidColorBrush(lineColor), lineThickness), new PenDescription(description)); }
/// <summary> /// Adds one dimensional graph with random color if line. /// </summary> /// <param name="pointSource">The point source.</param> /// <param name="lineThickness">The line thickness.</param> /// <returns></returns> public static LineGraph AddLineGraph(this Plotter2D plotter, IPointDataSource pointSource, double lineThickness) { return AddLineGraph(plotter, pointSource, ColorHelper.CreateRandomHsbColor(), lineThickness); }
/// <summary> /// Adds one dimensional graph with specified color of line. /// </summary> /// <param name="pointSource">The point source.</param> /// <param name="lineColor">Color of the line.</param> /// <returns></returns> public static LineGraph AddLineGraph(this Plotter2D plotter, IPointDataSource pointSource, Color lineColor) { return AddLineGraph(plotter, pointSource, lineColor, 1); }
/// <summary> /// Create a linegraph using specific datasource and settings /// </summary> /// <param name="pointSource">Data source</param> /// <param name="settings">Graph visual settings</param> public LineGraph(IPointDataSource pointSource,LineGraphSettings settings) : this() { this.Settings = settings; DataSource = pointSource; }
/// <summary> /// Initializes a new instance of the <see cref="LineGraph"/> class. /// </summary> /// <param name="pointSource">The point source.</param> public LineGraph(IPointDataSource pointSource) : this() { DataSource = pointSource; }
/// <summary> /// Create a linegraph using specific datasource and settings /// </summary> /// <param name="pointSource">Data source</param> /// <param name="settings">Graph visual settings</param> public LineGraph(IPointDataSource pointSource, LineGraphSettings settings) : this() { this.Settings = settings; DataSource = pointSource; }
/// <summary> /// Adds one dimensional graph. /// </summary> /// <param name="pointSource">The point source.</param> /// <param name="lineColor">Color of the line.</param> /// <param name="lineThickness">The line thickness.</param> /// <returns></returns> public static LineGraph AddLineGraph(this Plotter2D plotter, IPointDataSource pointSource, Color lineColor, double lineThickness) { return AddLineGraph(plotter, pointSource, new Pen(new SolidColorBrush(lineColor), lineThickness), null); }
/// <summary> /// Adds one dimensional graph. /// </summary> /// <param name="pointSource">The point source.</param> /// <param name="lineThickness">The line thickness.</param> /// <param name="description">The description.</param> /// <returns></returns> public static LineGraph AddLineGraph(this Plotter2D plotter, IPointDataSource pointSource, double lineThickness, string description) { var res = AddLineGraph(plotter, pointSource, new Pen(new SolidColorBrush(ColorHelper.CreateRandomHsbColor()), lineThickness), (PointMarker)null, new PenDescription(description)); return res.LineGraph; }
/// <summary> /// Create a linegraph using specific datasource and description /// </summary> /// <param name="pointSource">Data source</param> /// <param name="description">Description shown in legend</param> public LineGraph(IPointDataSource pointSource,string description) : this() { DataSource = pointSource; Settings = new LineGraphSettings() { Description = description}; }
public static LineAndMarker<ElementMarkerPointsGraph> AddLineGraph(this Plotter2D plotter, IPointDataSource pointSource, Pen linePen, ElementPointMarker marker, Description description) { if (pointSource == null) throw new ArgumentNullException("pointSource"); var res = new LineAndMarker<ElementMarkerPointsGraph>(); if (linePen != null) // We are requested to draw line graphs { LineGraph graph = new LineGraph { DataSource = pointSource, LinePen = linePen }; if (description != null) { graph.Description = description; } if (marker == null) { // Add inclination filter only to graphs without markers graph.Filters.Add(new InclinationFilter()); } graph.Filters.Add(new FrequencyFilter()); //graph.Filters.Add(new CountFilter()); res.LineGraph = graph; plotter.Children.Add(graph); } if (marker != null) // We are requested to draw marker graphs { ElementMarkerPointsGraph markerGraph = new ElementMarkerPointsGraph { DataSource = pointSource, Marker = marker }; res.MarkerGraph = markerGraph; plotter.Children.Add(markerGraph); } return res; }
public static IEnumerable<Point> GetPoints(IPointDataSource dataSource) { return GetPoints(dataSource, null); }
public static LineGraph AddLineGraph(this Plotter2D plotter, IPointDataSource pointSource, Pen linePen, Description description) { if (pointSource == null) throw new ArgumentNullException("pointSource"); if (linePen == null) throw new ArgumentNullException("linePen"); LineGraph graph = new LineGraph { DataSource = pointSource, LinePen = linePen }; if (description != null) { graph.Description = description; } graph.Filters.Add(new InclinationFilter()); graph.Filters.Add(new FrequencyFilter()); //graph.Filters.Add(new CountFilter()); plotter.Children.Add(graph); return graph; }