Chart - Autoscale axis

Stimulsoft Reports.NET discussion
IanMcCarthy
Posts: 37
Joined: Wed Oct 11, 2006 3:44 am

Chart - Autoscale axis

Post by IanMcCarthy »

Is it possible to get the y-axis to autoscale depending on the range of values being displayed?

I have data which sit around 70 to 140 so would like the chart to show only 70 to 140 not zero to 140.

Is this possible?

Many thanks

Ian
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Chart - Autoscale axis

Post by Vital »

You can use property Range - Axis.YAxis.Range.

This property avaialble only in version 2006.4

Thank you.
IanMcCarthy
Posts: 37
Joined: Wed Oct 11, 2006 3:44 am

Chart - Autoscale axis

Post by IanMcCarthy »

I have a chart on a detail data band, so this gets presented several times each with a different data set.

Can I determine the current valid data range for each chart during the render event and modify the chart range from there?

Thereby always expanding the chart to show the maximum detail.

Many thanks

Ian
IanMcCarthy
Posts: 37
Joined: Wed Oct 11, 2006 3:44 am

Chart - Autoscale axis

Post by IanMcCarthy »

I can't locate Range or even YAxis as a member of StiArea.

Range doesn't appear in the design view either.

Stimulsoft.Report.Chart.StiChart chart
chart.Area.???

Where exactly can I find the range member?
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Chart - Autoscale axis

Post by Vital »

Please use following path:

((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Range
IanMcCarthy
Posts: 37
Joined: Wed Oct 11, 2006 3:44 am

Chart - Autoscale axis

Post by IanMcCarthy »

Get reference to chart object:

Stimulsoft.Report.Chart.StiChart chart = report.Pages[0].GetComponents()["Chart1"] as Stimulsoft.Report.Chart.StiChart;

Try to set new range (don't know if this is the right way because I can't find any relevant documentation)
((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Range = new object[70, 140];

But compiler complains:
'Stimulsoft.Report.Chart.StiXAxis' does not contain a definition for 'Range'

Which is backed up by intellisense (no Range in list).

Ian
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Chart - Autoscale axis

Post by Edward »

IanMcCarthy wrote:Get reference to chart object:

Stimulsoft.Report.Chart.StiChart chart = report.Pages[0].GetComponents()["Chart1"] as Stimulsoft.Report.Chart.StiChart;

Try to set new range (don't know if this is the right way because I can't find any relevant documentation)
((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).XAxis.Range = new object[70, 140];

But compiler complains:
'Stimulsoft.Report.Chart.StiXAxis' does not contain a definition for 'Range'

Which is backed up by intellisense (no Range in list).

Ian
Sorry, but this code works only in StimulReport.Net 2006.4
You can download it from the following links:

http://www.stimulsoft.com/RegisteredUsers.aspx (for registered users)

http://www.stimulsoft.com/DownloadsSR.aspx (demo versions)

Thank you.
IanMcCarthy
Posts: 37
Joined: Wed Oct 11, 2006 3:44 am

Chart - Autoscale axis

Post by IanMcCarthy »

OK, updated to latest demo dlls and range is now available.

I want to set the range based upon the actual values of the YAxis data as the detail chart is drawn.

When I put code in the BeginRender event of the databand, the data series in the chart is still the demo data [1, 2, 3] not my sql data.

Can I achieve this?

Ian
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Chart - Autoscale axis

Post by Edward »

Please send your report to Image for analysis. If it is possible please provide your data for the chart (in any format).
Thank you.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Chart - Autoscale axis

Post by Vital »

Please use in version from 10.17.2006 following code in ProcessChartEvent of chart:

Code: Select all

Stimulsoft.Report.Chart.StiChart chart = sender as Stimulsoft.Report.Chart.StiChart;
Stimulsoft.Report.Chart.StiSeries series = chart.Series[0];
			
double dMax = double.MinValue;
double dMin = double.MaxValue;

foreach (double d in series.Values)
{
	dMin = Math.Min(d, dMin);
	dMax = Math.Max(d, dMax);
}

((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).YAxis.Range.Minimum = dMin;
((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).YAxis.Range.Maximum = dMax;
((Stimulsoft.Report.Chart.StiAxisArea)chart.Area).YAxis.Range.Auto = false;
Thank you.
Post Reply