Hi
Using event handlers (eg GetAxisDrawLabel) works nearly all the time. But Ive one window where it causes an exception. I think its due to my application being multi-threaded.
So is there another way to redraw the scale labels without using event handlers? i just want to loop through all the displayed labels and multiply the value by a scaling factor. eg. 0.01 would be changed to
10 for scaling factor 1000. Im using looking for a simple for loop really.
Thanks.
Possible to change scale labels without event handlers?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dave,
You could try using GetNextAxisLabel instead of GetAxisLabel. You may also be interested in playing with Custom Numeric Format Strings. You'll find more information about how to set axes labels format in Tutorial 4 - Axis Control, available at TeeChart's program group.
You could try using GetNextAxisLabel instead of GetAxisLabel. You may also be interested in playing with Custom Numeric Format Strings. You'll find more information about how to set axes labels format in Tutorial 4 - Axis Control, available at TeeChart's program group.
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 |
Narcis
Thanks. I checked out Tutorial 4 and a code snippet of what I want is shown below. But Im not sure how to implement the bit in the while loop.
int total = tChart.Axes.Bottom.Labels.Items.Count;
int Factor = 1000;
int tem = 0;
while (tem < total)
{
tChart1.Axes.Bottom.Labels.Items[count] = tChart1.Axes.Bottom.Labels.Items[count] * Factor;
tem = tem + 1;
}
Thanks. I checked out Tutorial 4 and a code snippet of what I want is shown below. But Im not sure how to implement the bit in the while loop.
int total = tChart.Axes.Bottom.Labels.Items.Count;
int Factor = 1000;
int tem = 0;
while (tem < total)
{
tChart1.Axes.Bottom.Labels.Items[count] = tChart1.Axes.Bottom.Labels.Items[count] * Factor;
tem = tem + 1;
}
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dave,
In that case the only solution I can think of is using custom labels as you already tried. Notice that Labels.Items.Count will return zero if no custom labels have been added to the chart. So that you can do something like this:
To avoid custom labels overlapping please read this thread. Please notice this is quite a long thread (has several pages) and what you are looking for may not appear in the first posts. However, several possibilities were discussed there and it covers a lot of ground on that area.
Hope this helps!
In that case the only solution I can think of is using custom labels as you already tried. Notice that Labels.Items.Count will return zero if no custom labels have been added to the chart. So that you can do something like this:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line1.FillSampleValues();
tChart1.Axes.Bottom.Labels.Angle = 90;
tChart1.Axes.Bottom.Labels.Items.Clear();
int Factor = 1000;
for (int i = 0; i < line1.Count; i++)
{
double tmp = line1.XValues[i] * Factor;
tChart1.Axes.Bottom.Labels.Items.Add(line1.XValues[i], tmp.ToString());
}
}
Hope this helps!
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 |