Page 1 of 1

Different colours for each of the labels/marks of a series

Posted: Mon Mar 13, 2006 12:51 pm
by 9638873
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

Posted: Tue Mar 14, 2006 1:30 pm
by narcis
Hi Reg Bust,

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;
        }
      }
    }
Or you can implement that code in the series GetSeriesMark event:

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;
      }
    }

Setting the colour of Marks.Items

Posted: Wed Mar 15, 2006 2:24 pm
by 9638873
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

Posted: Wed Mar 15, 2006 2:38 pm
by narcis
Hi Reg Bust,

Could you please post your files at news://www.steema.net/steema.public.attachments newsgroup?

Thanks in advance.

Charts sent via newsgroup

Posted: Wed Mar 15, 2006 3:07 pm
by 9638873
Hi

I've sent the attachments via the newsgroup.

Thank you.

Regards
Reg Bust

Posted: Wed Mar 15, 2006 3:31 pm
by narcis
Hi Reg Bust,

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;
      }
    }

Border around chart and clipping

Posted: Thu Mar 16, 2006 7:02 am
by 9088874
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

Thank you

Posted: Thu Mar 16, 2006 7:06 am
by 9088874
Thank you for the help with setting the colours and making the marks transparent.

All working now.

I have sent another request in a different topic.

Regards
Reg Bust