We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Column Series X-Axis Labels - Only shows every other label

Thread ID:

Created:

Updated:

Platform:

Replies:

95020 Jun 16,2010 03:49 PM Jun 18,2010 06:46 AM Silverlight 4
loading
Tags: Chart
john simmons
Asked On June 16, 2010 03:49 PM

Column series is only showing every other label for the data points on the X-Axis. If I put a Line series on the same chart (with no other changes to the chart), I get all the labels on the X-Axis.


Murugavel P [Syncfusion]
Replied On June 17, 2010 05:06 AM

Hi John,

Thanks for choosing Syncfusion products.

Chart axis ranges are calculated based on the series types. Column series requires an additional value to be added to the range values, so that the series will not be hidden. But Line series doesn't require these additional range values. This is the reason for this change in axis range values.

To disable this label changes, you can initialize the RangeCalculationMode property of Chart axis as AdjustAcrossChartTypes. So that all chart types add the additional range values.

The following code demonstrates how to disable this label changes in both XAML and C#.

[XAML]








[C#]

chart.Areas[0].PrimaryAxis.RangeCalculationMode = RangeCalculationMode.ConsistentAcrossChartTypes;



Please let us know if you have any questions about this.

Thanks,
Murugavel

john simmons
Replied On June 17, 2010 10:08 AM

Before I tell you the result of your suggestion, here's what I am doing:

The chart legend is configured to show the show/hide checkboxes.

I add a column chart series
I add a line chart series

When the chart is rendered, The X-Axis labels show every other data point label, starting at the 2nd data point. If I hide the column series, ALL of the labels are displayed. If I then hide the line series and re-show the column series, the labels revert to showing every other one.

I added those property settings you provided, and:

I still only see every other datapoint label, but when I hide the column series, I STILL only get every other label.

For grins, I set RangeCalculationMode="ConsistentAcrossChartTypes", and:

The chart now displays all datapoint labels for the column series and the line series, but the column series extends to the edges of the chart which results in the columns at the end being clipped.

I think this is a bug in your code.

john simmons
Replied On June 17, 2010 11:12 AM

I've attached a Word document that contains my code, XAML, and screenshots of what I'm seeing.




Syncfusion_126cf507.zip

Murugavel P [Syncfusion]
Replied On June 18, 2010 06:46 AM

Hi Jhon,

Thanks for choosing Syncfusion products.

You can display every labels of Chart based on the IsAutoSetRange property of Chart axis control.

If IsAutoSetRange property of Chart axis as True then axis labels interval are calculated based on the desired interval count. In the following lines of code, the DesiredIntervalsCount property is used to initialize the number of axis labels need to be display on the Chart.

[C#]
mainChart.Areas[0].PrimaryAxis.IsAutoSetRange = true;

//The DesiredIntervalsCount property is used to determine number of labels need to be display in Chart
mainChart.Areas[0].PrimaryAxis.DesiredIntervalsCount = data.Count;
mainChart.Areas[0].PrimaryAxis.RangeCalculationMode = SFChart.RangeCalculationMode.AdjustAcrossChartTypes;


If IsAutoSetRange property of Chart axis as False then you can manually initialize the Range values based on the series data count and set Interval as 1.

[C#]
mainChart.Areas[0].PrimaryAxis.IsAutoSetRange = false;
mainChart.Areas[0].PrimaryAxis.Range = new Syncfusion.Windows.Chart.DoubleRange(0, data.Count + 1);
mainChart.Areas[0].PrimaryAxis.Interval = 1;

I have modified the sample based on your requirement. Here with I have attached the updated sample.

Please let me know if you have any queries.

Thanks,
Murugavel




ChartSample_2dcfeaf6.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;