Swapping the x and z axis on a scColorGrid

TeeChart for ActiveX, COM and ASP
Post Reply
jacques
Newbie
Newbie
Posts: 30
Joined: Thu Nov 20, 2008 12:00 am
Location: South Africa
Contact:

Swapping the x and z axis on a scColorGrid

Post by jacques » Fri Jul 03, 2009 12:40 pm

Dear Sir\Madam

I am using the C++ component of Visual Studio 2008
I use a scColorGrid.
Data is entered into the grid in a sequence read from a file for instance the numeric value of 1 to 100 and displayed as follows

|5 10 15 100
|4 9 14 99
|3 8 13 98
|2 7 12......... 97
|1 6 11......... 96
|_____________________

In essence bottom to top, left to right

I would like the data to be displayed as follows:

|
|16 17 18 19 20
|11 12 13 14 15
|6 7 8 9 10
|1 2 3 4 5
|_________________________

but without changing the sequence of entering the data to the VARIANT that passes the data to the chart

Regards
Jacques

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

Re: Swapping the x and z axis on a scColorGrid

Post by Yeray » Fri Jul 03, 2009 12:55 pm

Hi Jacques,

I think you could try using GridTranspose tool? Something like following (this is Visual Basic 6):

Code: Select all

  TChart1.Tools.Add tcGridTranspose
  TChart1.Tools.Items(0).asGridTranspose.Series = TChart1.Series(0)
  TChart1.Tools.Items(0).asGridTranspose.Transpose
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

jacques
Newbie
Newbie
Posts: 30
Joined: Thu Nov 20, 2008 12:00 am
Location: South Africa
Contact:

Re: Swapping the x and z axis on a scColorGrid

Post by jacques » Fri Jul 03, 2009 2:28 pm

I translated the Visual basic to C++ as follows:

1) m_ssdPlotControl->GetTools().Add(tcGridTranspose);
2) m_ssdPlotControl->GetTools().GetItems(0).GetAsGridTranspose().GetSeries() = m_ssdPlotControl->Series(0);
3) m_ssdPlotControl->GetTools().GetItems(0).GetAsGridTranspose().Transpose();

but I get the following error

1>c:\pds\projects\gew\cjpu_iii\sw\pc\tada\snapshotmodule.cpp(826) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'CSeries' (or there is no acceptable conversion)
1> c:\program files\microsoft sdks\windows\v6.0a\include\oaidl.h(492): could be 'tagVARIANT &tagVARIANT::operator =(const tagVARIANT &)'


for line 3 of the code.


Could you perhaps explain what I am doing wrong

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

Re: Swapping the x and z axis on a scColorGrid

Post by Narcís » Fri Jul 03, 2009 2:53 pm

Hi jaques,

You can do something like this:

Code: Select all

	m_Chart1.Series(scSurface);
	m_Chart1.Series(2).FillSampleValues(10);

	m_Chart1.GetTools().Add(tcGridTranspose);
	m_Chart1.GetTools().GetItems(0).GetAsGridTranspose().SetSeries(COleVariant("2"));
	m_Chart1.GetTools().GetItems(0).GetAsGridTranspose().Transpose();
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

jacques
Newbie
Newbie
Posts: 30
Joined: Thu Nov 20, 2008 12:00 am
Location: South Africa
Contact:

Re: Swapping the x and z axis on a scColorGrid

Post by jacques » Mon Jul 06, 2009 7:29 am

Hello Narcis,

I implemented your code :
m_Chart1.Series(scSurface);
m_Chart1.Series(2).FillSampleValues(10);

m_Chart1.GetTools().Add(tcGridTranspose);
m_Chart1.GetTools().GetItems(0).GetAsGridTranspose().SetSeries(COleVariant("2"));
m_Chart1.GetTools().GetItems(0).GetAsGridTranspose().Transpose();

I however changed it as follows:

m_Chart1.AddSeries(scSurface);
m_Chart1.Series(0).FillSampleValues(10);

m_Chart1.GetTools().Add(tcGridTranspose);
m_Chart1.GetTools().GetItems(0).GetAsGridTranspose().SetSeries(COleVariant(_T("0"))); // BECAUSE WE ARE USING UNICODE
m_Chart1.GetTools().GetItems(0).GetAsGridTranspose().Transpose();


I plotted the chart, afterwards I removed the transpose tool, thus only using

m_Chart1.AddSeries(scSurface);
m_Chart1.Series(02).FillSampleValues(10);

And the plot remains the same, the axis from left to right is indexed 1 to 10,I feel this is incorrect as I would expect the x and z axis to swap.

Regards
Jacques

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

Re: Swapping the x and z axis on a scColorGrid

Post by Narcís » Mon Jul 06, 2009 8:40 am

Hi Jacques,

Code below works fine for me here. Can you please try if it works fine for you?

Code: Select all

	long surfa = m_Chart1.AddSeries(scSurface);
	m_Chart1.Series(0).FillSampleValues(10);

	m_Chart1.GetTools().Add(tcGridTranspose);
	m_Chart1.GetTools().GetItems(0).GetAsGridTranspose().SetSeries(COleVariant(surfa));
	m_Chart1.GetTools().GetItems(0).GetAsGridTranspose().Transpose();
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

jacques
Newbie
Newbie
Posts: 30
Joined: Thu Nov 20, 2008 12:00 am
Location: South Africa
Contact:

Re: Swapping the x and z axis on a scColorGrid

Post by jacques » Mon Jul 06, 2009 9:23 am

This works fine.

Thank you very much.

Regards
JB

Post Reply