/// <summary> /// Draws first chart only. /// </summary> public void DrawChart(XGraphics gfx) { XGraphicsState state = gfx.Save(); gfx.TranslateTransform(this.location.X, this.location.Y); if (this.chartList.Count > 0) { XRect chartRect = new XRect(0, 0, this.size.Width, this.size.Height); Chart chart = (Chart)this.chartList[0]; RendererParameters parms = new RendererParameters(gfx, chartRect); parms.DrawingItem = chart; ChartRenderer renderer = GetChartRenderer(chart, parms); renderer.Init(); renderer.Format(); renderer.Draw(); } gfx.Restore(state); }
/// <summary> /// Draws all charts inside the ChartFrame. /// </summary> public void Draw(XGraphics gfx) { // Draw frame of ChartFrame. First shadow frame. int dx = 5; int dy = 5; gfx.DrawRoundedRectangle(XBrushes.Gainsboro, this.location.X + dx, this.location.Y + dy, this.size.Width, this.size.Height, 20, 20); XRect chartRect = new XRect(this.location.X, this.location.Y, this.size.Width, this.size.Height); XLinearGradientBrush brush = new XLinearGradientBrush(chartRect, XColor.FromArgb(0xFFD0DEEF), XColors.White, XLinearGradientMode.Vertical); XPen penBorder = new XPen(XColors.SteelBlue, 2.5); gfx.DrawRoundedRectangle(penBorder, brush, this.location.X, this.location.Y, this.size.Width, this.size.Height, 15, 15); XGraphicsState state = gfx.Save(); gfx.TranslateTransform(this.location.X, this.location.Y); // Calculate rectangle for all charts. Y-Position will be moved for each chart. int charts = this.chartList.Count; uint dxChart = 20; uint dyChart = 20; uint dyBetweenCharts = 30; XRect rect = new XRect(dxChart, dyChart, this.size.Width - 2 * dxChart, (this.size.Height - (charts - 1) * dyBetweenCharts - 2 * dyChart) / charts); // draw each chart in list foreach (Chart chart in this.chartList) { RendererParameters parms = new RendererParameters(gfx, rect); parms.DrawingItem = chart; ChartRenderer renderer = GetChartRenderer(chart, parms); renderer.Init(); renderer.Format(); renderer.Draw(); rect.Y += rect.Height + dyBetweenCharts; } gfx.Restore(state); // // Calculate rectangle for all charts. Y-Position will be moved for each chart. // int charts = this.chartList.Count; // uint dxChart = 0; // uint dyChart = 0; // uint dyBetweenCharts = 0; // XRect rect = new XRect(dxChart, dyChart, // this.size.Width - 2 * dxChart, // (this.size.Height - (charts - 1) * dyBetweenCharts - 2 * dyChart) / charts); // // // draw each chart in list // foreach (Chart chart in this.chartList) // { // RendererParameters parms = new RendererParameters(gfx, rect); // parms.DrawingItem = chart; // // ChartRenderer renderer = GetChartRenderer(chart, parms); // renderer.Init(); // renderer.Format(); // renderer.Draw(); // // rect.Y += rect.Height + dyBetweenCharts; // } }