Hi
I have a point series to which I add points.
I want to be able to set the colour for the label/mark/text for each of the points in the series.
That is, I want to be able to say that the label/name for this point is Green, that this point is Blue, etc.
I know that by setting
.ColorEach = True
and by specifying using the Series.Add that allows a color as in
.Series(1).Add(2,3, "Label",Color.Blue)
that I can set the color for the markers (little colored icons) for each point.
But I want to be able to colour the Text/Label/Mark that appears next to each point.
Please help.
Regards
Reg Bust
Different colours for each of the labels/marks of a series
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Reg Bust,
Yes, you can do something like this:
Or you can implement that code in the series GetSeriesMark event:
Yes, you can do something like this:
Code: Select all
private void Form1_Load(object sender, EventArgs e)
{
line1.FillSampleValues();
for (int i = 0; i < line1.Count; ++i)
{
if (line1.YValues[i] % 2 == 0)
{
line1.Marks.Items[i].Font.Color = Color.Blue;
line1.Marks.Items[i].Color = Color.White;
}
else
{
line1.Marks.Items[i].Font.Color = Color.Red;
line1.Marks.Items[i].Font.Bold = true;
line1.Marks.Items[i].Font.Size = 10;
line1.Marks.Items[i].Color = Color.Yellow;
}
}
}
Code: Select all
private void line1_GetSeriesMark(Steema.TeeChart.Styles.Series series, Steema.TeeChart.Styles.GetSeriesMarkEventArgs e)
{
if (line1.YValues[e.ValueIndex] % 2 == 0)
{
line1.Marks.Items[e.ValueIndex].Font.Color = Color.Blue;
line1.Marks.Items[e.ValueIndex].Color = Color.White;
}
else
{
line1.Marks.Items[e.ValueIndex].Font.Color = Color.Red;
line1.Marks.Items[e.ValueIndex].Font.Bold = true;
line1.Marks.Items[e.ValueIndex].Font.Size = 10;
line1.Marks.Items[e.ValueIndex].Color = Color.Yellow;
}
}
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 |
Setting the colour of Marks.Items
Hi Narcis
Thank you for this.
I implemented your first approach and set
line1.Marks.Items(i).Font.Color = myColor
After I had added the point.
It works, but ....
Just that single change in the code causes other changes to my chart.
Now each of the text labels for my points have little boxes around them, with black labels, and these boxes are not transparent so that one blocks the view of the other.
(I wish I could include exported pictures of the chart before and after.)
I tried evey option I could in the TeeChart Editor (called from within my application) to get rid of these boxes but they remain stubbornly there.
Note that in my application I start by loading a "template" (just a tee chart which has the series, colours, etc. previously saved). My application then just adds points to my pre-defined series. I suspect that my template that I start with is responsible for this.
How can I send it (the template) to you? (I can't send attachments in this forum).
Regards
Reg Bust
Thank you for this.
I implemented your first approach and set
line1.Marks.Items(i).Font.Color = myColor
After I had added the point.
It works, but ....
Just that single change in the code causes other changes to my chart.
Now each of the text labels for my points have little boxes around them, with black labels, and these boxes are not transparent so that one blocks the view of the other.
(I wish I could include exported pictures of the chart before and after.)
I tried evey option I could in the TeeChart Editor (called from within my application) to get rid of these boxes but they remain stubbornly there.
Note that in my application I start by loading a "template" (just a tee chart which has the series, colours, etc. previously saved). My application then just adds points to my pre-defined series. I suspect that my template that I start with is responsible for this.
How can I send it (the template) to you? (I can't send attachments in this forum).
Regards
Reg Bust
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Reg Bust,
Could you please post your files at news://www.steema.net/steema.public.attachments newsgroup?
Thanks in advance.
Could you please post your files at news://www.steema.net/steema.public.attachments newsgroup?
Thanks in advance.
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 |
Charts sent via newsgroup
Hi
I've sent the attachments via the newsgroup.
Thank you.
Regards
Reg Bust
I've sent the attachments via the newsgroup.
Thank you.
Regards
Reg Bust
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Reg Bust,
Thanks for the files.
Then you can make the marks transparent:
Thanks for the files.
Then you can make the marks transparent:
Code: Select all
private void Form1_Load(object sender, EventArgs e)
{
line1.FillSampleValues();
for (int i = 0; i < line1.Count; ++i)
{
if (line1.YValues[i] % 2 == 0)
{
line1.Marks.Items[i].Font.Color = Color.Blue;
line1.Marks.Items[i].Color = Color.White;
}
else
{
line1.Marks.Items[i].Font.Color = Color.Red;
line1.Marks.Items[i].Font.Bold = true;
line1.Marks.Items[i].Font.Size = 10;
line1.Marks.Items[i].Color = Color.Yellow;
}
line1.Marks.Items[i].Transparent = true;
}
}
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 |
Border around chart and clipping
Hi
I have sent a chart (in .ten and .png format) via the newsgroup (the .NET v2 newsgroup).
Please tell me how to:
1. Remove the space at the left, right and bottom of the chart. (The space that is not part of the grid.)
2. Currently some of my labels (e.g. "Zaptronix" on the extreme left) extend into that space. I still want those to be visible. If necessary I can do this with code as I manually set the axis min and max.
3. Extend the minor tick marks on both axes so that they are on both sides of the axis (as the major tick marks are).
4. Get rid of the outermost blue border especially the rounded corners.
In all instances I really want to be able to do this via the TeeCharts Editor and not via code (if possible).
Thank you.
Kind regards
Reg Bust
I have sent a chart (in .ten and .png format) via the newsgroup (the .NET v2 newsgroup).
Please tell me how to:
1. Remove the space at the left, right and bottom of the chart. (The space that is not part of the grid.)
2. Currently some of my labels (e.g. "Zaptronix" on the extreme left) extend into that space. I still want those to be visible. If necessary I can do this with code as I manually set the axis min and max.
3. Extend the minor tick marks on both axes so that they are on both sides of the axis (as the major tick marks are).
4. Get rid of the outermost blue border especially the rounded corners.
In all instances I really want to be able to do this via the TeeCharts Editor and not via code (if possible).
Thank you.
Kind regards
Reg Bust