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

Diffrent values beetween Area Chart and Stacked Area Chart problem.

6 Answers 37 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pawel
Top achievements
Rank 1
Pawel asked on 23 Nov 2012, 08:53 AM
Hello I have a problem with the Area chart. When i use that type of chart my result is not correct. I mean that the plot not match x-axis values. When i use Stacked Area type the values are correct. I use the same datasource and all settings, i am only changing the type.

I tried to grapchically show my problem, can you tell me how to add attachement?.
This is my grapchic interpretation, i hope someone will understand me.
http://i50.tinypic.com/2qk4046.png

I really appreciate any ideas why this situation is happening.

Regards, Paul.

6 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 23 Nov 2012, 08:57 AM
Hi Paul,

We did not find any attachments to this forum. Allowed extensions in forums are jpg, gif, png. It would be best if you could also provide an excerpt from your data, in case we need to test this locally.

All the best,
Steve
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!

0
Pawel
Top achievements
Rank 1
answered on 23 Nov 2012, 09:01 AM
Hi, thanks for reaction. I couldn find an option to add attachement. This is external link to image: http://i50.tinypic.com/2qk4046.png
0
Steve
Telerik team
answered on 23 Nov 2012, 09:34 AM
Hi Paul,

Thanks for the screenshot, but we would need an example that shows the problematic behavior as we cannot reproduce it locally.

Kind regards,
Steve
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!

0
Pawel
Top achievements
Rank 1
answered on 27 Nov 2012, 12:39 PM
To reproduce the sample you can simply create class:
public class DataChartItem
    {
        public int X { get; set; }
        public int Y1 { get; set; }
        public int Y2 { get; set; }
    }

Then create a list of that items:
List<DataChartItem> listOfItems = new List<DataChartItem>();
            listOfItems.Add(new DataChartItem() { X = 42, Y1 = 163720, Y2 = 484000});
            listOfItems.Add(new DataChartItem() { X = 44, Y1 = 138720, Y2 = 294000 });
            listOfItems.Add(new DataChartItem() { X = 46, Y1 = 126720, Y2 = 294000 });
            listOfItems.Add(new DataChartItem() { X = 50, Y1 = 126720, Y2 = 294000 });
            listOfItems.Add(new DataChartItem() { X = 54, Y1 = 284720, Y2 = 294000 });
            listOfItems.Add(new DataChartItem() { X = 55, Y1 = 114720, Y2 = 294000 });
            listOfItems.Add(new DataChartItem() { X = 60, Y1 = 120000, Y2 = 0 });
            listOfItems.Add(new DataChartItem() { X = 65, Y1 = 120000, Y2 = 0 });
            listOfItems.Add(new DataChartItem() { X = 67, Y1 = 120000, Y2 = 48000 });
            listOfItems.Add(new DataChartItem() { X = 70, Y1 = 120000, Y2 = 48000 });
            listOfItems.Add(new DataChartItem() { X = 75, Y1 = 120000, Y2 = 48000 });
            listOfItems.Add(new DataChartItem() { X = 80, Y1 = 120000, Y2 = 48000 });
            listOfItems.Add(new DataChartItem() { X = 85, Y1 = 0, Y2 = 0 });
            listOfItems.Add(new DataChartItem() { X = 90, Y1 = 0, Y2 = 0 });
            listOfItems.Add(new DataChartItem() { X = 95, Y1 = 0, Y2 = 0 });


And then Bind this lists to Serie1 and Serie2. Serie 1 and Serie 2 neds X property as  X value and Serie1 needs Y1 as Y values, Serie 2 needs Y2 as Y value.
Create two charts with only one difference: Type of chart. First Area, Second StackedArea
            Report1 report = new Report1();
            report.chart1.DataSource = listOfItems;
            report.chart2.DataSource = listOfItems;

This is my char1 and chart 2:
//
            // chart1
            //
            this.chart1.BitmapResolution = 96F;
            this.chart1.DefaultType = Telerik.Reporting.Charting.ChartSeriesType.Area;
            this.chart1.ImageFormat = System.Drawing.Imaging.ImageFormat.Emf;
            this.chart1.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Cm(0.00010012308484874666D), Telerik.Reporting.Drawing.Unit.Cm(0D));
            this.chart1.Name = "chart1";
            this.chart1.PlotArea.XAxis.Appearance.Visible = Telerik.Reporting.Charting.Styles.ChartAxisVisibility.True;
            this.chart1.PlotArea.XAxis.AutoScale = false;
            this.chart1.PlotArea.XAxis.AutoShrink = false;
            this.chart1.PlotArea.XAxis.DataLabelsColumn = "X";
            chartAxisItem15.Value = new decimal(new int[] {
            1,
            0,
            0,
            0});
            chartAxisItem16.Value = new decimal(new int[] {
            2,
            0,
            0,
            0});
            chartAxisItem17.Value = new decimal(new int[] {
            3,
            0,
            0,
            0});
            chartAxisItem18.Value = new decimal(new int[] {
            4,
            0,
            0,
            0});
            chartAxisItem19.Value = new decimal(new int[] {
            5,
            0,
            0,
            0});
            chartAxisItem20.Value = new decimal(new int[] {
            6,
            0,
            0,
            0});
            chartAxisItem21.Value = new decimal(new int[] {
            7,
            0,
            0,
            0});
            this.chart1.PlotArea.XAxis.Items.AddRange(new Telerik.Reporting.Charting.ChartAxisItem[] {
            chartAxisItem15,
            chartAxisItem16,
            chartAxisItem17,
            chartAxisItem18,
            chartAxisItem19,
            chartAxisItem20,
            chartAxisItem21});
            this.chart1.PlotArea.XAxis.LayoutMode = Telerik.Reporting.Charting.Styles.ChartAxisLayoutMode.Normal;
            this.chart1.PlotArea.XAxis.MinValue = 1D;
            this.chart1.PlotArea.XAxis.Visible = Telerik.Reporting.Charting.Styles.ChartAxisVisibility.True;
            this.chart1.PlotArea.YAxis.MaxValue = 100D;
            this.chart1.PlotArea.YAxis.Step = 10D;
            chartSeries5.DataXColumn = "X";
            chartSeries5.DataYColumn = "Y1";
            chartSeries5.Name = "Series 1";
            chartSeries5.Type = Telerik.Reporting.Charting.ChartSeriesType.Area;
            chartSeries6.DataXColumn = "X";
            chartSeries6.DataYColumn = "Y2";
            chartSeries6.Name = "Series 2";
            chartSeries6.Type = Telerik.Reporting.Charting.ChartSeriesType.Area;
            this.chart1.Series.AddRange(new Telerik.Reporting.Charting.ChartSeries[] {
            chartSeries5,
            chartSeries6});
            this.chart1.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Cm(14.999797821044922D), Telerik.Reporting.Drawing.Unit.Cm(8.1999998092651367D));
            //
            // pageFooterSection1
            //
            this.pageFooterSection1.Height = Telerik.Reporting.Drawing.Unit.Cm(3D);
            this.pageFooterSection1.Name = "pageFooterSection1";
            //
            // chart2
            //
            this.chart2.BitmapResolution = 96F;
            this.chart2.DefaultType = Telerik.Reporting.Charting.ChartSeriesType.StackedArea;
            this.chart2.ImageFormat = System.Drawing.Imaging.ImageFormat.Emf;
            this.chart2.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Cm(0.00010012308484874666D), Telerik.Reporting.Drawing.Unit.Cm(9.5D));
            this.chart2.Name = "chart2";
            this.chart2.PlotArea.XAxis.Appearance.Visible = Telerik.Reporting.Charting.Styles.ChartAxisVisibility.True;
            this.chart2.PlotArea.XAxis.AutoScale = false;
            this.chart2.PlotArea.XAxis.AutoShrink = false;
            this.chart2.PlotArea.XAxis.DataLabelsColumn = "X";
            chartAxisItem22.Value = new decimal(new int[] {
            1,
            0,
            0,
            0});
            chartAxisItem23.Value = new decimal(new int[] {
            2,
            0,
            0,
            0});
            chartAxisItem24.Value = new decimal(new int[] {
            3,
            0,
            0,
            0});
            chartAxisItem25.Value = new decimal(new int[] {
            4,
            0,
            0,
            0});
            chartAxisItem26.Value = new decimal(new int[] {
            5,
            0,
            0,
            0});
            chartAxisItem27.Value = new decimal(new int[] {
            6,
            0,
            0,
            0});
            chartAxisItem28.Value = new decimal(new int[] {
            7,
            0,
            0,
            0});
            this.chart2.PlotArea.XAxis.Items.AddRange(new Telerik.Reporting.Charting.ChartAxisItem[] {
            chartAxisItem22,
            chartAxisItem23,
            chartAxisItem24,
            chartAxisItem25,
            chartAxisItem26,
            chartAxisItem27,
            chartAxisItem28});
            this.chart2.PlotArea.XAxis.LayoutMode = Telerik.Reporting.Charting.Styles.ChartAxisLayoutMode.Normal;
            this.chart2.PlotArea.XAxis.MinValue = 1D;
            this.chart2.PlotArea.XAxis.Visible = Telerik.Reporting.Charting.Styles.ChartAxisVisibility.True;
            this.chart2.PlotArea.YAxis.MaxValue = 90D;
            this.chart2.PlotArea.YAxis.Step = 10D;
            chartSeries7.DataXColumn = "X";
            chartSeries7.DataYColumn = "Y1";
            chartSeries7.Name = "Series 1";
            chartSeries7.Type = Telerik.Reporting.Charting.ChartSeriesType.StackedArea;
            chartSeries8.DataXColumn = "X";
            chartSeries8.DataYColumn = "Y2";
            chartSeries8.Name = "Series 2";
            chartSeries8.Type = Telerik.Reporting.Charting.ChartSeriesType.StackedArea;
            this.chart2.Series.AddRange(new Telerik.Reporting.Charting.ChartSeries[] {
            chartSeries7,
            chartSeries8});
            this.chart2.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Cm(14.999797821044922D), Telerik.Reporting.Drawing.Unit.Cm(8.1999998092651367D));


Now generate the pdf.

I hope you can reproduce it. I wanted to attach whole code but I cannot attach a zip.

Regards.

0
Pawel
Top achievements
Rank 1
answered on 28 Nov 2012, 11:56 AM
Hello, can someone help me ? I'll really appreciate it.

Regards
0
Steve
Telerik team
answered on 30 Nov 2012, 01:05 PM
Hello Pawel,

Thank you for the sample code, we were able to reproduce the problem on our end and identified the culprit for the Area series. The problem occurs whenever you have both DataXColumn of the series and DataLabelsColumn of the XAxis defined. Remove the DataXColumn of the series and the chart would be rendered as expected. If you however want the items to be distributed in such uneven way, then you should remove the DataLabelsColumn of the XAxis.

Regards,
Steve
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
Pawel
Top achievements
Rank 1
Answers by
Steve
Telerik team
Pawel
Top achievements
Rank 1
Share this question
or