hi there,
besides the option to automatically asign the labels on an axis i need two options where one can enter either the wanted gap between labels or the number of labels he wants to see.
e.g. ymin=0,ymax=2000, option 1=>gap=500(entered)
=>5 labels(0,500,1000,1500,2000)
option 2=>labelcount=3(entered)
=>3 labels(666,1333,1999(or 2k))
how to archieve this? i tried some own functions but they wont work very accurately...is there a way to say e.g. labels at 0 and 2000 are allways shown and only the rest is calculated? how to get back to automatic asignment?
best regards,
robert
setting increments
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi robert,
You can easily achieve what you request doing something like this:
You can easily achieve what you request doing something like this:
Code: Select all
private double Gap=500;
private int NumLabels=3;
private void SetLabels()
{
if (checkBox1.Checked)
tChart1.Axes.Bottom.Increment=Gap;
else
tChart1.Axes.Bottom.Increment=(tChart1.Axes.Bottom.Maximum-tChart1.Axes.Bottom.Minimum)/NumLabels;
}
private void Form1_Load(object sender, System.EventArgs e)
{
for (int i=0;i<=2000;++i)
{
line1.Add(i);
}
tChart1.Axes.Bottom.SetMinMax(0,2000);
SetLabels();
}
private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
{
SetLabels();
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi rob,
Ok, then you can set the axis increment to zero as it is the minimum step between axis labels. It must be a positive number or DateTime value. TChart will use this value as the starting axis labels step. If there is not enough space for all labels, TChart will calculate a bigger one.
Ok, then you can set the axis increment to zero as it is the minimum step between axis labels. It must be a positive number or DateTime value. TChart will use this value as the starting axis labels step. If there is not enough space for all labels, TChart will calculate a bigger one.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |