Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: TChart Multiple left axis



Permlink Replies: 11 - Last Post: Jan 18, 2018 12:52 AM Last Post By: vijayalakshmi b Threads: [ Previous | Next ]
vijayalakshmi b

Posts: 17
Registered: 2/9/18
TChart Multiple left axis
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2018 12:24 AM
How to create two left axis on a line chart in Teechart? I dont have a steema software.Do I need Steema s/w for multiple axis?
Yeray Alonso

Posts: 73
Registered: 6/12/11
Re: TChart Multiple left axis
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2018 12:46 AM   in response to: vijayalakshmi b in response to: vijayalakshmi b
Hello,

vijayalakshmi b wrote:
How to create two left axis on a line chart in Teechart? I dont have a steema software.Do I need Steema s/w for multiple axis?

Custom axes are available with the Lite version shipped with the IDE:
http://www.teechart.net/docs/teechart/vclfmx/tutorials/UserGuide/Tutorials/tutorial4.htm#MultiAxis

--
Best Regards,

Yeray Alonso
Steema Software
Facebook, Twitter, GPlus, LinkedIn, YouTube, GitHub, RSS
Support Options
vijayalakshmi b

Posts: 17
Registered: 2/9/18
Re: TChart Multiple left axis
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2018 2:57 AM   in response to: vijayalakshmi b in response to: vijayalakshmi b
Thanks Yeray Alonso,
Is it possible in c++ also?
Can you suggest a c++ forum
Yeray Alonso

Posts: 73
Registered: 6/12/11
Re: TChart Multiple left axis
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2018 3:37 AM   in response to: vijayalakshmi b in response to: vijayalakshmi b
Hello,

It shouldn't be too difficult to translate delphi code to c++. Here an example:

  Chart1->Title->Text->Text = "TChart Multiple axes";
  Chart1->View3D = False;
 
  for (int t = 0; t < 10; t++)
  {
	Series1->AddXY(t,10+t,"",clTeeColor);
	if (t > 1)
	  Series2->AddXY(t,t/2,"",clTeeColor);
  }
 
  TChartAxis *MyAxis = new TChartAxis(Chart1);
  Series2->CustomVertAxis = MyAxis;
 
  //You can modify any property of the new created axes, such as the axis color or axis title
  MyAxis->Axis->Color = Series2->Color;
  MyAxis->Title->Caption = "Extra axis";
  MyAxis->Title->Font->Style = MyAxis->Title->Font->Style << fsBold;
  MyAxis->Title->Angle = 90;
  MyAxis->PositionPercent = 10; //percentage of Chart rectangle
  MyAxis->StartPosition = 50;
  MyAxis->EndPosition = 100;
 
  Chart1->Axes->Left->StartPosition = 0;
  Chart1->Axes->Left->EndPosition = 50;
  Chart1->Axes->Left->Title->Caption = "1st Left Axis";
  Chart1->Axes->Left->Title->Font->Style = Chart1->Axes->Left->Title->Font->Style << fsBold;
  Chart1->Axes->Left->Axis->Color = Series1->Color;


--
Best Regards,

Yeray Alonso
Steema Software
Facebook, Twitter, GPlus, LinkedIn, YouTube, GitHub, RSS
Support Options
vijayalakshmi b

Posts: 17
Registered: 2/9/18
Re: TChart Multiple left axis
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2018 4:47 AM   in response to: Yeray Alonso in response to: Yeray Alonso
Is there an option to start both graph at same point ,ie. after secondary axis , so that they don't overlap.
Yeray Alonso

Posts: 73
Registered: 6/12/11
Re: TChart Multiple left axis
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2018 5:52 AM   in response to: vijayalakshmi b in response to: vijayalakshmi b
Hello,

vijayalakshmi b wrote:
Is there an option to start both graph at same point ,ie. after secondary axis , so that they don't overlap.

I don't understand what do you mean. Could you please post a link to some screenshot showing it?

--
Best Regards,

Yeray Alonso
Steema Software
Facebook, Twitter, GPlus, LinkedIn, YouTube, GitHub, RSS
Support Options
vijayalakshmi b

Posts: 17
Registered: 2/9/18
Re: TChart Multiple left axis
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2018 9:01 PM   in response to: Yeray Alonso in response to: Yeray Alonso
Hi,

The graph has to be like the one in the link
https://canvasjs.com/blog/11/16/canvasjs-v1-9-5-goes-ga/
Yeray Alonso

Posts: 73
Registered: 6/12/11
Re: TChart Multiple left axis
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2018 11:20 PM   in response to: vijayalakshmi b in response to: vijayalakshmi b
Hello,

vijayalakshmi b wrote:
The graph has to be like the one in the link
https://canvasjs.com/blog/11/16/canvasjs-v1-9-5-goes-ga/

Instead of modifying the StartPosition and EndPosition of both axes, you should only set a negative PositionPercent for one of them. You should also set a MarginLeft and hide one of the Grids. Ie:

  Chart1->View3D = False;
 
  Series1->FillSampleValues();
  Series2->FillSampleValues();
 
  TChartAxis *MyAxis = new TChartAxis(Chart1);
  Series2->CustomVertAxis = MyAxis;
 
  MyAxis->Axis->Color = Series2->Color;
  MyAxis->Title->Caption = "Extra axis";
  MyAxis->Title->Font->Style = MyAxis->Title->Font->Style << fsBold;
  MyAxis->Title->Angle = 90;
  MyAxis->PositionPercent = -15;
  MyAxis->Grid->Visible = False;
 
  Chart1->Axes->Left->Title->Caption = "1st Left Axis";
  Chart1->Axes->Left->Title->Font->Style = Chart1->Axes->Left->Title->Font->Style << fsBold;
  Chart1->Axes->Left->Axis->Color = Series1->Color;
 
  Chart1->MarginLeft = 10;


--
Best Regards,

Yeray Alonso
Steema Software
Facebook, Twitter, GPlus, LinkedIn, YouTube, GitHub, RSS
Support Options
vijayalakshmi b

Posts: 17
Registered: 2/9/18
Re: TChart Multiple left axis
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2018 12:18 AM   in response to: Yeray Alonso in response to: Yeray Alonso
Thank you Yeray Alonso
vijayalakshmi b

Posts: 17
Registered: 2/9/18
Re: TChart Multiple left axis
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2018 4:23 AM   in response to: vijayalakshmi b in response to: vijayalakshmi b
Is There a way i can write the titles of the axis close to it....ie. is it possible to change the distance between axis and title?
vijayalakshmi b

Posts: 17
Registered: 2/9/18
Re: TChart Multiple left axis
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2018 4:11 AM   in response to: vijayalakshmi b in response to: vijayalakshmi b
Thank you Yeray Alonso.
vijayalakshmi b

Posts: 17
Registered: 2/9/18
Re: TChart Multiple left axis
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 18, 2018 12:52 AM   in response to: vijayalakshmi b in response to: vijayalakshmi b
vijayalakshmi b wrote:
How to create two left axis on a line chart in Teechart? I dont have a steema software.Do I need Steema s/w for multiple axis?

i tried working for secondary horizontal axis but it is not working
this is my code
{ TChartAxis *MyAxis = new TChartAxis(Chart1);
Series2->CustomHorizAxis = MyAxis; }
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02