This is a migrated thread and some comments may be shown as answers.

Chart:Mutiple Bar-Line Chart

1 Answer 73 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
linnet
Top achievements
Rank 1
linnet asked on 26 Oct 2012, 08:01 AM

Hi.

I'm using Telerik Reporting Q2 2012.
I want to create a chart which like attached image(chart.png).

Following is DataSource:
YEAR        MARKET            AMOUNT         RATE
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
2005        MARKET_A              38.98       
2005        MARKET_B              326.9       
2006        MARKET_A              48.36          24%
2006        MARKET_B             367.89          13%
2007        MARKET_A              59.13          22%
2007        MARKET_B             476.44          30%
2008        MARKET_A              75.27          27%
2008        MARKET_B             594.79          25%
2009        MARKET_A              92.75          23%
2009        MARKET_B             723.68          22%
2010        MARKET_A              25.15         -73%
2010        MARKET_B             192.56         -73%
I create four chartSeries objects (for two bars and two lines).
And set chart.DataGroupColumn to column "MARKET".

Designer.cs

private void InitializeComponent()
{
    // variable initialize and detail design code
    // ...
    this.chart1.Bindings.Add(new Telerik.Reporting.Binding("DataSource", "= Fields.Data"));
    this.chart1.DataGroupColumn = "MARKET";
    this.chart1.DataSource = this.objectDataSource1;
    this.chart1.Docking = Telerik.Reporting.DockingStyle.Fill;
    this.chart1.IntelligentLabelsEnabled = true;
    this.chart1.Name = "chart1";
    this.chart1.PlotArea.XAxis.AutoScale = false;
    this.chart1.PlotArea.XAxis.DataLabelsColumn = "YEAR";
    // create ChartSeries
    chartSeries1.DataYColumn = "AMOUNT";
    chartSeries1.Name = "Series 1";
    chartSeries2.DataYColumn = "AMOUNT";
    chartSeries2.Name = "Series 4";
    chartSeries3.DataYColumn = "RATE";
    chartSeries3.Name = "Series 2";
    chartSeries3.YAxisType = Telerik.Reporting.Charting.ChartYAxisType.Secondary;
    chartSeries4.DataYColumn = "RATE";
    chartSeries4.Name = "Series 3";
    chartSeries4.YAxisType = Telerik.Reporting.Charting.ChartYAxisType.Secondary;
    this.chart1.Series.AddRange(new Telerik.Reporting.Charting.ChartSeries[] 
    {
        chartSeries1, chartSeries2, chartSeries3, chartSeries4
    });
    // objectDataSource1
    this.objectDataSource1.DataMember = "Data";
    this.objectDataSource1.DataSource = typeof(SFuture.Common.Service.ReportModel);
    this.objectDataSource1.Name = "objectDataSource1";
      
    // Report1 design code
    // ...
}

But it's not work.
Please take a look into the attached image(bad_chart.png).

Any idea?
Thank you for the support!

1 Answer, 1 is accepted

Sort by
0
Elian
Telerik team
answered on 30 Oct 2012, 02:57 PM
Hi Linnet,

When using the DataGroupColumn property, the chart will automatically group the data according the the column that you have set and will automatically create the series. If you create the series manually, you cannot filter their data. So in short, to implement your requirements, you will need to create the series programmatically and group the data manually. You can check the following examples:
 
Regards,
Elian
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

Tags
General Discussions
Asked by
linnet
Top achievements
Rank 1
Answers by
Elian
Telerik team
Share this question
or