Page 1 of 1
Swapping the x and z axis on a scColorGrid
Posted: Fri Jul 03, 2009 12:40 pm
by 15050891
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
Re: Swapping the x and z axis on a scColorGrid
Posted: Fri Jul 03, 2009 12:55 pm
by yeray
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
Re: Swapping the x and z axis on a scColorGrid
Posted: Fri Jul 03, 2009 2:28 pm
by 15050891
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
Re: Swapping the x and z axis on a scColorGrid
Posted: Fri Jul 03, 2009 2:53 pm
by narcis
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();
Re: Swapping the x and z axis on a scColorGrid
Posted: Mon Jul 06, 2009 7:29 am
by 15050891
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
Re: Swapping the x and z axis on a scColorGrid
Posted: Mon Jul 06, 2009 8:40 am
by narcis
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.
Re: Swapping the x and z axis on a scColorGrid
Posted: Mon Jul 06, 2009 9:23 am
by 15050891
This works fine.
Thank you very much.
Regards
JB