private AbstractLineChartCanvas CreateCanvas(LineChartType type) { AbstractLineChartCanvas canvas; switch (type) { case LineChartType.Normal: canvas = new LineChartCanvas(); break; case LineChartType.Stacked: canvas = new StackedLineChartCanvas(); break; default: return(null); } BindingOperations.SetBinding(canvas, AbstractLineChartCanvas.XAxisProperty, new Binding("XAxis") { Source = this }); BindingOperations.SetBinding(canvas, AbstractLineChartCanvas.YAxisProperty, new Binding("YAxis") { Source = this }); return(canvas); }
/// <summary> /// Initializes a new instance of the <see cref="LineChart"/> class. /// </summary> /// <param name="lineChartType">Type of the line chart.</param> /// <param name="values">The values.</param> /// <param name="width">The width.</param> /// <param name="dotSize">Size of the dot.</param> /// <param name="haloSize">Size of the halo.</param> public LineChart(LineChartType lineChartType, List <IChartValue> values, int width, int dotSize, int haloSize) : base(EnumUtility.GetChartTypeFromLineChartType(lineChartType), values) { this.Width = width; this.DotSize = dotSize; this.HaloSize = haloSize; }
private void OnChartTypeChanged(LineChartType type) { if (Canvas != null) { // We're about to no longer use this canvas. // Thus we HAVE to force it remove itself from all events // of the series collection (and its values) or otherweise // we're gonna have a leak.. Canvas.Series = null; RemoveCanvas(Canvas); } Canvas = CreateCanvas(type); if (Canvas != null) { Grid.SetColumn(Canvas, 1); Canvas.Series = Series; AddCanvas(Canvas); } }
/// <summary> /// Gets the type of the chart type from line chart. /// </summary> /// <param name="lineChartType">Type of the line chart.</param> /// <returns></returns> internal static ChartType GetChartTypeFromLineChartType(LineChartType lineChartType) { return((ChartType)Enum.Parse(typeof(ChartType), lineChartType.ToString(), true)); }
/// <summary> /// Create a line chart with the specified type. /// </summary> /// <param name="width">width in pixels</param> /// <param name="height">height in pixels</param> /// <param name="lineChartType">specifies how the chart handles datasets</param> public LineChart(int width, int height, LineChartType lineChartType) : base(width, height) { this.lineChartType = lineChartType; }
/// <summary> /// Create a line chart with one line per dataset. Points are evenly spaced along the x-axis. /// </summary> /// <param name="width">width in pixels</param> /// <param name="height">height in pixels</param> public LineChart(int width, int height) : base(width, height) { this.lineChartType = LineChartType.SingleDataSet; }
/// <summary> /// Initializes a new instance of the <see cref="LineChart"/> class. /// </summary> /// <param name="lineChartType">Type of the line chart.</param> /// <param name="values">The values.</param> public LineChart(LineChartType lineChartType, List <IChartValue> values) : base(EnumUtility.GetChartTypeFromLineChartType(lineChartType), values) { }