public Form1() { InitializeComponent(); InitializeDropDownList(); this.EnabledQSFButtons = QSFButtons.None; BarSeries barSerias = new BarSeries(); barSerias.ValueMember = "Value"; barSerias.CategoryMember = "Date"; barSerias.DataSource = DrillDownViewModel.ParseDataByYear(); radChartView1.Views.AddNew(); radChartView1.Views.AddNew(); radChartView1.Title = "Revenue by Years"; this.radChartView1.ChartElement.ShowTitle = true; radChartView1.ChartElement.TitlePosition = TitlePosition.Top; DrillDownController controller = new DrillDownController(); this.radChartView1.Controllers.Add(controller); this.radChartView1.Drill += new DrillEventHandler(radChartView1_Drill); this.radChartView1.ShowDrillNavigation = true; FillColors(this.radChartView1.View, KnownPalette.Warm); DateTimeContinuousAxis horizontalAxis = new DateTimeContinuousAxis(); horizontalAxis.MajorStepUnit = Charting.TimeInterval.Year; horizontalAxis.MajorStep = 1; horizontalAxis.LabelFormat = "{0:yyyy}"; horizontalAxis.Title = "Year"; LinearAxis verticalAxis = new LinearAxis(); verticalAxis.AxisType = AxisType.Second; verticalAxis.Title = "USD"; barSerias.HorizontalAxis = verticalAxis; barSerias.VerticalAxis = horizontalAxis; radChartView1.Series.Add(barSerias); this.radChartView1.LabelFormatting += new ChartViewLabelFormattingEventHandler(radChartView1_LabelFormatting); this.radChartView1.ShowTrackBall = false; //smartLabelsController.Strategy = new FalpLabelStrategy(); this.radChartView1.Controllers.Add(smartLabelsController); CartesianArea area = this.radChartView1.GetArea <CartesianArea>(); area.ShowGrid = true; this.FillBarSeries(barSerias); }
void radChartView1_Drill(object sender, DrillEventArgs e) { CartesianSeries series = new BarSeries(); series.ValueMember = "Value"; series.CategoryMember = "Date"; DateTimeCategoricalAxis horizontalAxis = new DateTimeCategoricalAxis(); CartesianArea area = e.View.GetArea <CartesianArea>(); area.ShowGrid = true; CartesianGrid grid = area.GetGrid <CartesianGrid>(); grid.DrawHorizontalStripes = true; grid.DrawVerticalStripes = true; this.radChartView1.ShowTrackBall = false; switch (e.Level) { case 0: series.DataSource = DrillDownViewModel.ParseDataByYear(); radChartView1.Title = "Revenue by Years"; grid.DrawVerticalStripes = false; this.FillBarSeries(series); break; case 1: if (e.SelectedPoint != null) { year = ((DrillDownDataInfo)e.SelectedPoint.DataItem).Date.Year; } series.DataSource = DrillDownViewModel.ParseDataByMonth(year); radChartView1.Title = "Revenue by Months"; horizontalAxis.LabelFormat = "{0:MMMM}"; horizontalAxis.Title = "Months"; grid.DrawVerticalStripes = false; this.FillBarSeries(series); break; case 2: if (e.SelectedPoint != null) { month = ((DrillDownDataInfo)e.SelectedPoint.DataItem).Date.Month; } series = new LineSeries(); series.ValueMember = "Value"; series.CategoryMember = "Date"; series.DataSource = DrillDownViewModel.ParseDataByDay(year, month); series.ShowLabels = true; series.DrawLinesToLabels = true; series.SyncLinesToLabelsColor = false; series.LinesToLabelsColor = Color.Black; radChartView1.Title = "Revenue by Days"; horizontalAxis.LabelFormat = "{0:dd}"; horizontalAxis.Title = "Days"; this.radChartView1.ShowTrackBall = true; grid.DrawVerticalStripes = true; series.ForeColor = Color.Black; this.SetTrackBall(); break; } e.View.Axes.Clear(); series.HorizontalAxis = horizontalAxis; e.View.Series.Clear(); e.View.Series.Add(series); this.FillColors(e.View, KnownPalette.Warm); }