Page 1 of 1

Queries for color grid series

Posted: Tue Sep 03, 2013 12:55 pm
by 9526439
Hi,

We are currently using Tee-Chart Active X 7.0. We are facing a problem related to Color Grid series. We have plotted the data through the Color Grid series. When we open the T-Chart editor and select the Grid 3D tab, three tabs i.e. “Single” tab or “Range” tab or “Palette” tab appear.

Here when we change the colors either through the “Single” tab or “Range” tab or “Palette” tab, the grid plotted do not update with the color changes. But if I go to “Single” tab and click on button “Remove custom colors”, the white portions of the color grid also gets colored and now all the color changes done either through the “Single” tab or “Range” tab or “Palette” tab do affect the color grid plotted on T-Chart.

I wanted to handle the “Remove custom colors” option at code level, but was not able to find the same. Please suggest.

Also, when we change the Range or Palette style, the legend gets updated

I want to get the list of all the colors, which gets updated on the legend, when I change the Range or Palette style. I was trying the same with the following code, but it retrieved wrong colors.

long LegendItems = m_Chart.Series(colorgridseriesindex).CountLegendItems();
for(int i=0;i<LegendItems;i++)
{
unsigned long color = m_Chart.Series(colorgridseriesindex). LegendItemColor(i);
}


Please suggest if there is any way to directly access the updated colors.

Regards,
Hardeep

Re: Queries for color grid series

Posted: Wed Sep 04, 2013 3:08 pm
by yeray
Hello,
amol wrote:I wanted to handle the “Remove custom colors” option at code level, but was not able to find the same. Please suggest.
This button is actually looping the array of colors and setting clTeeColor to all the points. Something like this:

Code: Select all

  With TChart1.Series(0)
    For t = 0 To Count - 1
      .PointColor(i) = clTeeColor
    Next t
  End With
amol wrote:I want to get the list of all the colors, which gets updated on the legend, when I change the Range or Palette style. I was trying the same with the following code, but it retrieved wrong colors.

long LegendItems = m_Chart.Series(colorgridseriesindex).CountLegendItems();
for(int i=0;i<LegendItems;i++)
{
unsigned long color = m_Chart.Series(colorgridseriesindex). LegendItemColor(i);
}

Please suggest if there is any way to directly access the updated colors.
You can use the TChart1.Legend.LastValue as last index for the legend items. Here it is an example:

Code: Select all

Private Sub Form_Load()
  TChart1.Aspect.View3D = False
  TChart1.AddSeries scColorGrid
  TChart1.Series(0).FillSampleValues
End Sub

Private Sub TChart1_OnAfterDraw()
  Dim tmpTop, tmpLeft As Integer
  tmpTop = TChart1.Legend.Top + 5
  tmpLeft = TChart1.Legend.Left - 12

  Dim i As Integer
  For i = 0 To TChart1.Legend.LastValue
    With TChart1.Canvas
      .Brush.Style = bsSolid
      .Brush.Color = TChart1.Series(0).LegendItemColor(i)
      .Rectangle tmpLeft, tmpTop + (i * 13), tmpLeft + 10, tmpTop + (i * 13) + 7
    End With
  Next i
End Sub
As you'll see in the image below, I've drawn the rectangles with the symbol colors, next to the symbols.
ColorGridLegend.png
ColorGridLegend.png (76.14 KiB) Viewed 11708 times

Re: Queries for color grid series

Posted: Tue Sep 10, 2013 1:19 pm
by 9526439
Hi Yeray,

Thanks for your guidance. It helped me a lot. There is one more query related to color grid series itself.

When I open the T-Chart editor and select the "Grid3D" tab, and in that I select "Range" tab, I find a button named as "Gallery". In this option there are various combinations of color sequences under "Default" tab like "Ace", "Business", and "Caribe Sun" and so on.

I wanted to find a way to either set or get the options under Gallery button at code level, but was not able to find the same.

Please suggest.

Regards,
Hardeep

Re: Queries for color grid series

Posted: Fri Sep 13, 2013 8:01 am
by narcis
Hi Hardeep,

There's an example of this at the features demo, at All Features\Welcome!\Chart Styles\Surface\Surface Rainbow.