Skip to main content Skip to footer

Scale the Pivot Chart’s axis to display many items and avoid overlapping labels

When working with ComponentOne FlexPivot for WinForms, it's very typical to have a view that has too many dimensions to plot nicely on the chart. Unless you define all views for the end-users, there's nothing stopping someone from creating a view which looks like this:

WinForms FlexPivot Chart Labels Overlapping

There are so many axis labels that they overlap. Even the chart bars themselves are very tiny and narrow that it's hard to read. One possible solution is to filter the data so that less data is in the view. But what might be best, and easiest, is to configure the chart to efficiently show the data no matter how large or small it may be.

A better solution is to automatically display axis scrollbars when there is a large number of items along the x-axis. The C1FlexPivotChart control extends C1Chart, which includes support for axis scaling. We can easily turn on axis scaling and display a scrollbar with 2 lines of code:

c1FlexPivotPage1.OlapChart.ChartArea.AxisX.ScrollBar.Visible = true;  
c1FlexPivotPage1.OlapChart.ChartArea.AxisX.ScrollBar.Scale = 0.5;

This code sets the scale to 0.5 which is 50%. Basically, that means you will see half of the data at one time and can scroll to see the rest. You can further customize the scrollbar look and position by setting the ScrollBar's Appearance and Alignment properties. Now, your olap chart will always display a friendly looking plot, no matter how many items your OLAP view contains.

WinForms FlexPivot Chart Labels