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

Databind Line Chart Design Time

4 Answers 123 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Betsy
Top achievements
Rank 1
Betsy asked on 18 Feb 2011, 03:41 PM
I have a SQLDataSource that produces three columns:AccountNumber, Date, Amount.  I want to databind a LineChart to have the AccountNumber drive the series, PostDate on XAxis and Amount on YAxis.  I'm part way there.  I have the DataGroupColumn set to AccountNumber so when I run the report a line generates for each AccountNumber.  The amount shows on the YAxis but I am getting 1,2,3,4,5 on the XAxis.  How do I get my date values to show on the XAxis?  I tried usagechart.PlotArea.XAxis.DataLabelsColumn = "PostDate" but thats not doing anything.  Can I format my data values to not show cents?  Do I have to do that in the NeedDatasource or can I do it from the designer?

4 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 23 Feb 2011, 06:23 PM
Hi Heather,

Please check out the Displaying Incremental DateTime Values in the X-Axis of RadChart blog that elaborates on using date values for the XAxis.

Best wishes,
Peter
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Betsy
Top achievements
Rank 1
answered on 15 Mar 2011, 09:14 PM
OK after testing and testing and testing I thnk I found the issue.  I downloaded the sample from the blog post you referred me to and finally got my app working.  HOWEVER, If I attempt to apply a skin to the chart I cannot get the labels to display with the date format.
0
Steve
Telerik team
answered on 18 Mar 2011, 04:29 PM
Hello Heather,

We're not sure how setting the skin causes the problem since we have a runnable example of this functionality with Skin applied, see it here. Can you confirm that the problem occurs when setting skin to the project from the blog post?

Kind regards,
Steve
the Telerik team
0
MikeWiese
Top achievements
Rank 1
answered on 28 May 2011, 03:08 AM
Hi Heather,

There is a problem that setting the 'Skin' Property of a chart in the report designer obliterates many of the chart PlotArea properties. I have had problems with the following, for example:

  • Appearance.Dimensions.Margins
  • XAxis.Appearance.ValueFormat
  • XAxis.Appearance.CustomFormat
  • XAxis.Appearance.LabelAppearance.RotationAngle
  • XAxis.Appearance.LabelAppearance.Position.AlignedPosition

On setting the chart's Skin property in the designer, these properties (and others no doubt) all revert to default values.

Furthermore, you can't use the designer to set these properties back once you have set a Skin property. You can try, and they look OK in the designer, but so long as the 'Skin' property is not null, they are ignored at runtime. 

This has come up at least a couple of times in these forums and has been acknowledged by Telerik as a bug. but no fix yet. As they suggested, the only recourse is to set the desired properties programatically in the constructor of your report. In my case, it looked something like the following:

public MyReport()
{
    //
    // Required for telerik Reporting designer support
    //
    InitializeComponent();
    //
    // TODO: Add any constructor code after InitializeComponent call
    //
    // We need to set these graphical properties here, as the presence of a Skin cause them to be overwritten:
    this.myChart.PlotArea.XAxis.Appearance.ValueFormat = ChartValueFormat.ShortDate;
    this.myChart.PlotArea.XAxis.Appearance.CustomFormat = "dd-MMM";
    this.myChart.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 270;
    this.myChart.PlotArea.XAxis.Appearance.LabelAppearance.Position.AlignedPosition = AlignedPositions.Top;
    // Sizing of chart area
    this.myChart.PlotArea.Appearance.Dimensions.Margins = "14%, 4%, 15%, 10%";
}

I'm running version 5.0.11.510 (Telerik Reporting Q1 2011 SP1). Hopefully a fix will come soon.

Regards,
Mike

Tags
General Discussions
Asked by
Betsy
Top achievements
Rank 1
Answers by
Peter
Telerik team
Betsy
Top achievements
Rank 1
Steve
Telerik team
MikeWiese
Top achievements
Rank 1
Share this question
or