Legend shows wrong colors for Surface Series

TeeChart for ActiveX, COM and ASP
Post Reply
yvb
Newbie
Newbie
Posts: 18
Joined: Mon Jul 13, 2009 12:00 am

Legend shows wrong colors for Surface Series

Post by yvb » Tue Feb 15, 2011 1:03 pm

Hi,
I am using TeeChart pro V8.0.0.6 Version v Active x, C++.
I am trying to use 3D Surface Series with my own pallets. as described in the code bellow.
The problem is that the surface colors are correct in the plot, but the legend shows the correct values(1,11,21,31) as defined in the calls to AddPalette(...) but he colors are different that the ones in the calls to AddPalette(...). It seems to be that the legend is using another palette for the chart.
1. Why do I get the wrong colors?
2. Is there a full example of using SurfaceSeries in C++ Active X?
Thanks;
YVB

Code: Select all

	m_Chart.Series(m_lSeriesId).GetAsSurface().ClearPalette();
	m_Chart.Series(m_lSeriesId).GetAsSurface().AddPalette(1, RGB(0, 00, 0));
	m_Chart.Series(m_lSeriesId).GetAsSurface().AddPalette(11, RGB(255, 0, 0));
	m_Chart.Series(m_lSeriesId).GetAsSurface().AddPalette(21, RGB(0, 255, 0));
	m_Chart.Series(m_lSeriesId).GetAsSurface().AddPalette(31, RGB(0, 0, 255));

	m_Chart.Series(m_lSeriesId).GetAsSurface().AddXYZ(1, 0, 2,"",m_Chart.Series(m_lSeriesId).GetAsSurface().GetSurfacePaletteColor(0));
	m_Chart.Series(m_lSeriesId).GetAsSurface().AddXYZ(2, 10, 3,"",m_Chart.Series(m_lSeriesId).GetAsSurface().GetSurfacePaletteColor(10));
	m_Chart.Series(m_lSeriesId).GetAsSurface().AddXYZ(3, 20, 4,"",m_Chart.Series(m_lSeriesId).GetAsSurface().GetSurfacePaletteColor(20));
	m_Chart.Series(m_lSeriesId).GetAsSurface().AddXYZ(4, 30, 5,"",m_Chart.Series(m_lSeriesId).GetAsSurface().GetSurfacePaletteColor(30));

	m_Chart.Series(m_lSeriesId).GetAsSurface().SetUsePalette(true);
	m_Chart.GetLegend().GetSymbol().SetSquared(true);
	m_Chart.Repaint();

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Legend shows wrong colors for Surface Series

Post by Sandra » Thu Feb 17, 2011 12:16 pm

Hello

I recommend you update your TeeChart ActiveX version 8 for last Build that you can find in page download. When you have update your version, please try again if your problem persist and if it still appears please try to send us a simple project we can run as-is to reproduce the problem here so we can help you find a good solution.

Thanks,
Best Regards,
Sandra Pazos / 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

yvb
Newbie
Newbie
Posts: 18
Joined: Mon Jul 13, 2009 12:00 am

Re: Legend shows wrong colors for Surface Series

Post by yvb » Wed Feb 23, 2011 7:48 am

Hi Sandra,
I prepared a project using TeeChart pro v8.0.0.8. The problem was not solved.
How do I send the project to you? I don't see any possibility for an attachemnt here.
Thanks,
yvb

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

Re: Legend shows wrong colors for Surface Series

Post by Narcís » Wed Feb 23, 2011 8:00 am

Hi yvb,

Yes, this forums board allows attachments at the bottom of the messages you'll see an "upload attachment option. Otherwise you can post them at our upload page.

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
Image Image Image Image Image Image
Instructions - How to post in this forum

yvb
Newbie
Newbie
Posts: 18
Joined: Mon Jul 13, 2009 12:00 am

Re: Legend shows wrong colors for Surface Series

Post by yvb » Wed Feb 23, 2011 2:51 pm

Attached is the file containing the solution in VS 2008 of my code.
I switched to TeeCahrt pro v8.0.0.8. But it didn’t help.

When executing to application click the “Test 3D Compact” button from the dialogue window.
The code using TChart is in CTchartDisplay::test3D_Compact() and CTchartDisplay::OnAfterDrawTchart1().

I am trying to do two things:
1. Display a 2D color Grid where each cell color represents a value in a specific range.
2. Draw a rotated ellipse over the grid.
I tried to implement thus by using Surface series, where the coordinate system was rotated by 270 degrees
Around the X axis, so the chart is viewed as 2D XZ coordinate system from the Y axis direction. The value Y for each XZ grid
point is displayed at a corresponding color that I defined in a color palette.
My problems/questions are:
1. The legend does not show the correct colors, but it shows the correct value ranges. How can I fix it?
2. How do I draw a rotated ellipse on the grid that is on the XZ plane? The RotatedEllipse() function draws the ellipse on the XY plane ( or parallel to it) so only it’s projection is seen on the grid as a red line.
3. How can I get the value of a Z coordinate in pixels, similar to CalcXPosValue(…) ?. This may enable me to draw shapes in the XZ plane.
4. Will the usage of ColorGrid Series instead of Surface Series simplify things and solve some of the problems?

Thanks,
yvb
Attachments
StabilizationTeeChartForSteema.zip
(353.95 KiB) Downloaded 731 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Legend shows wrong colors for Surface Series

Post by Sandra » Mon Feb 28, 2011 1:20 pm

Hello yvb,
1. The legend does not show the correct colors, but it shows the correct value ranges. How can I fix it?
I recommend you use property ColorRange, and change it to false as do in below lines of code:

Code: Select all

	m_Chart.Series(0).GetAsSurface().SetUseColorRange(false);
My problems/questions are:
2. How do I draw a rotated ellipse on the grid that is on the XZ plane? The RotatedEllipse() function draws the ellipse on the XY plane ( or parallel to it) so only it’s projection is seen on the grid as a red line.
3. How can I get the value of a Z coordinate in pixels, similar to CalcXPosValue(…) ?. This may enable me to draw shapes in the XZ plane.
4. Will the usage of ColorGrid Series instead of Surface Series simplify things and solve some of the problems?
Yes, if you use ColorGrid, the problems that you have when you draw ellipse disappears. I have made a simple code for your using a ColorGrid Series instead of Surface Series and works fine for me here. Please, check if next code works as you want:

InitializeChart:

Code: Select all

void CTchartDisplay::test3D_Compact()
{
	m_Chart.GetAspect().SetView3D(false);
  
	m_Chart.AddSeries(scColorGrid);
	m_Chart.Series(0).FillSampleValues(13);
	m_Chart.Series(0).GetPen().SetColor(RGB(0,255,255));
	m_Chart.GetEnvironment().InternalRepaint();
	m_Chart.GetLegend().GetSymbol().SetSquared(true);

	m_Chart.GetCanvas().GetPen().SetColor(RGB(255,0,0));
	m_Chart.GetCanvas().GetPen().SetWidth(2);
}
AfterDraw Event:

Code: Select all

		
void CTchartDisplay::OnAfterDrawTchart1()
{
m_Chart.GetCanvas().GetPen().SetColor(RGB(255,0,0));
	m_Chart.GetCanvas().GetPen().SetWidth(2);

	long x1 = m_Chart.GetAxis().GetTop().CalcXPosValue(4.0);
	long y1 = m_Chart.GetAxis().GetLeft().CalcYPosValue(5.0);
	long x2 = m_Chart.GetAxis().GetBottom().CalcXPosValue(6.0);
	long y2 = m_Chart.GetAxis().GetRight().CalcYPosValue(7.0);
	m_Chart.GetCanvas().RotatedEllipse(y1,x1,y2,x2,100, 0);

 }
I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

yvb
Newbie
Newbie
Posts: 18
Joined: Mon Jul 13, 2009 12:00 am

Re: Legend shows wrong colors for Surface Series

Post by yvb » Thu Mar 03, 2011 7:08 am

Hi,
Thanks Sandra, everything works now in my application.

Best regards,
yvb

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Legend shows wrong colors for Surface Series

Post by Sandra » Thu Mar 03, 2011 9:22 am

Hello yvb,

I am glad that your problems are solved :).

Thanks,
Best Regards,
Sandra Pazos / 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