Page 1 of 1
Sample data in chart does not care about real min and max
Posted: Wed Nov 09, 2011 3:29 pm
by 16060157
When using the chart object in design time, the values of the sample data are not generated within the valid value range.
It seems as the sample (random) data is always generated in the range 0-1000, no matter what the Xmin/max and Ymin/max properties are set to.
Re: Sample data in chart does not care about real min and max
Posted: Thu Nov 10, 2011 8:54 am
by 10050769
Hello BeijerElectronics,
When using the chart object in design time, the values of the sample data are not generated within the valid value range.
It seems as the sample (random) data is always generated in the range 0-1000, no matter what the Xmin/max and Ymin/max properties are set to.
The values you are adding in design time, are an example of how fill a Series,where we use a radom to create this data and axes haven't to be explicitly related to the data, unless you set values you want, so you could have a range of data 100-200 and axes have diferent range 0-50 and data aren't painting in the range of axes. Therefore if you want axes have same range of data, you need indicate the exact values you want axes get. Next I have made a simple example, where I have filled a Line series with simple data. And also, I have set a determinate range of axes, using property SetMinMax of Bottom and Left Axes.
Code: Select all
private void InitializeChart()
{
Steema.TeeChart.Styles.Line line1 = new Line(tChart1.Chart);
tChart1.Aspect.View3D = false;
Random rnd = new Random();
for (int i = 0; i < 50; i )
{
line1.Add(i, rnd.Next(100));
}
tChart1.Axes.Left.SetMinMax(line1.YValues.Minimum, line1.YValues.Maximum);
tChart1.Axes.Bottom.SetMinMax(line1.XValues.Minimum, line1.XValues.Maximum);
}
Please can you tell us, if it is a good solution for you?
I hope will helps.
Thanks,
Re: Sample data in chart does not care about real min and max
Posted: Fri Nov 11, 2011 11:22 am
by 16060157
Hello Sandra,
We rather not generate our own sample data, since your FillSampleValues does a very good job for the different chart types. What we need is simple to be able to pass in our minimum Y and maximum Y values to that method, together with number of values which is what you have today, like FilleSampleValues(5, 0, 100). Then when your current sample generation logic does not find a minimum or maximum (since we don’t add any values ourself), you fallback on the passed in minimum and maximum parameter values, rather than the hardcoded maximum of 1000 as you have today.
Re: Sample data in chart does not care about real min and max
Posted: Fri Nov 11, 2011 12:34 pm
by 10050769
Hello BeijerElectronics,
I recommend you, create your custom FilleSampleValues method. I suggest you do something as next code, where is created a custom FillsampleValues and is set a Minimum and Maximum when there aren't values in the Chart.
Code: Select all
private void InitializeChart()
{
Steema.TeeChart.Styles.Bar bar1 = new Bar (tChart1.Chart);
tChart1.Aspect.View3D = false;
FillSampleValues(bar1, 0, 0, 110);
bar1.Marks.Visible = false;
}
private void FillSampleValues(Steema.TeeChart.Styles.Series s, int NumPoints, double min, double max)
{
if (NumPoints != 0)
{
s.FillSampleValues(NumPoints);
}
s.GetVertAxis.SetMinMax(min, max);
}
Please can you tell us if previous code works as you expect?
Then when your current sample generation logic does not find a minimum or maximum (since we don’t add any values ourself), you fallback on the passed in minimum and maximum parameter values, rather than the hardcoded maximum of 1000 as you have today.
I can not reproduce it in my last version of TeeChart.Net, so if I have added values around 100 the minimum and maximum depends of this values.
I hope will helps.
Thanks,
Re: Sample data in chart does not care about real min and max
Posted: Wed Nov 16, 2011 9:02 am
by 16060157
Hi,
Of course we can generate our own sample data, but we would like to avoid that for several reasons, and we're quite happy with the sample data you are generating. What we would like is for you to fix the "bug" in your sample data code where you fallback on a fixed constant of 0 as minimum axis value and 1000 as maxiumum axis value. If you simply could expose these constants or let use pass the min and max values in to your sample data method everything would be so much easier and better for us.
Is this something you can fix for the next release?
Thanks!
Re: Sample data in chart does not care about real min and max
Posted: Thu Nov 17, 2011 3:04 pm
by 10050769
Hello BeijerElectronics,
We doesn't consider your request as a bug, so this method behave correctly. Moreover, you need know that method FillSampleValues() is create for testing data and if you need it do something concretely I recommend you make your custom FillSampleValues method as I explain in my last post and I think can help you to achieve as you want.
Thanks,