Page 1 of 1

Problem with TChartAxis

Posted: Wed Jun 02, 2010 12:24 pm
by 10055512
hi,

I am using the TChartAxis class to customise the axis when I try to split a graphics where there are two graphs creating two, everyone with their title, etc. The problem is that the title doesn't appears. If I only show one of them, it doesn't matter which, the title appears, but not in both.

I show you the code and I'll try to explain you.

Can you help me if you see something wrong

thanks in advance
Josep Miquel Salvador

// Loop for the graphs
for(int i=0;i<NumeroVols;i++){
Axis = new TChartAxis( Chart2->CustomAxes ); // I create a new tcharaxis (one for every graph)
Axis->StartPosition = part;
Axis->EndPosition = part + partIni;
if(col == 0) Axis->LabelsFont->Color = clWhite;
Axis->LabelsSize = 25;
if(ContColor == 6) ContColor = 0;
Axis->Axis->Color = Llista_Colors.RegPLlista_Colors[ContColor]; // get color
ContColor++;

//I get the title
DString NomCY = "";
Nombre_Campo (campos_Y[0/*Valor_Y*/].tipo,NomCY,false);
TEnumTipoMagnitudes magn;
magn = Magnitud_Campo(campos_Y[0/*Valor_Y*/].tipo);
NomCY << " [" << Unidades.Nombre_Unidad_Mag (magn) <<"]";
Axis->Title->Caption = NomCY; // here the string is "Height Graph (m)"
Axis->Title->Angle = 90;

VolsSeries.RegPVol_Serie.EixY.RegPLineSeries[0].CustomVertAxis = Axis; // I assign this axis to the series
part = part + partIni;
}

Re: Problem with TChartAxis

Posted: Thu Jun 03, 2010 1:36 pm
by yeray
Hi Salvador,

In the code snipped above we can see too many variables unknown or undefined. It would help us to understand what are you exactly trying to do if you could send a simple example project we can run as-is to reproduce the issue here.

Thanks in advance.

Salut! ;)

Re: Problem with TChartAxis

Posted: Fri Jun 04, 2010 9:31 am
by 10055512
hi Yeray,

It it difficult to give you an exemple of this because my code is very related to personal variables.
I'll try to simplify.
If I draw only one chart, (if I run the loop once, the title of the graphs appears)
If I draw two, no title in any chart.
I hope that you understand my problem now.

Thanks in advance
soulianis
Salut i bon cap de setmana !

-----------------------------------------------------------------------

int partIni = 50;
int part =0;
TLineSeries VolsSeries[2];
TChart *Chart2;


// Loop for the 2 graphs
for(int i=0;i<2;i++){
Axis = new TChartAxis( Chart2->CustomAxes ); // I create a new tchartaxis (one for every graph)
Axis->StartPosition = part;
Axis->EndPosition = part + partIni;
Axis->LabelsSize = 25;
if (i==0)
Axis->Axis->Color = 255;
else
Axis->Axis->Color = 16711680;

//I get the title
Axis->Title->Caption = " [Height Graph (m)"]";
Axis->Title->Angle = 90;

VolsSeries.CustomVertAxis = Axis; // I assign this axis to the series
part = part + partIni;
}

Re: Problem with TChartAxis

Posted: Fri Jun 04, 2010 3:37 pm
by narcis
Hi Josep,

Sorry, but it's still not clear to me what you are trying to do. Can you please attach a simple example project we can run "as-is" to reproduce the probem here and debug it?

Gràcies i bon cap de setmana també!

Re: Problem with TChartAxis

Posted: Wed Nov 24, 2010 2:43 pm
by 10055512
hi again,

My problem is not solved. I will attach a couple of images to explain my problem. At first (image before_click) , when the chart appears the vertical axis texts almost doesn't appear.
If I click on the chart (image after_click) the texts appear more, overlapped but they appears.

What can be the problem ?
I am looking for the answer and I can't find the solution.

thanks in advance
soulianis
before_click.png
before_click.png (5.69 KiB) Viewed 4016 times
after_click.png
after_click.png (6.47 KiB) Viewed 4024 times

Re: Problem with TChartAxis

Posted: Wed Nov 24, 2010 3:53 pm
by yeray
Hi soulianis,

Clicking on the chart changes it? Are you using OnClick event to change something on it?
If not, it could be a chart repaint more than a click. If so, you could try forcing the chart to be redrawn when the initialization finishes. Try the call:

Code: Select all

Chart1->Draw();
You could also try adding some margin to the left side of your chart:

Code: Select all

Chart1->MarginLeft = 10;
I hope it helps!