Queries for color grid series

TeeChart for ActiveX, COM and ASP
Post Reply
amol
Advanced
Posts: 231
Joined: Tue Mar 29, 2005 5:00 am

Queries for color grid series

Post by amol » Tue Sep 03, 2013 12:55 pm

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

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Queries for color grid series

Post by Yeray » Wed Sep 04, 2013 3:08 pm

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 11964 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

amol
Advanced
Posts: 231
Joined: Tue Mar 29, 2005 5:00 am

Re: Queries for color grid series

Post by amol » Tue Sep 10, 2013 1:19 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Queries for color grid series

Post by Narcís » Fri Sep 13, 2013 8:01 am

Hi Hardeep,

There's an example of this at the features demo, at All Features\Welcome!\Chart Styles\Surface\Surface Rainbow.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply