Page 1 of 1

No control over Y axis labels for TCustomSeries?

Posted: Fri Aug 27, 2004 8:53 pm
by 8438518
Our code is relatively simple, we instantiate an instance of one of
the chart types
e.g.
TPointSeries* S = new TPointSeries(mChart);
where Chart::TChart* mChart;
do a minimal bit of setting parameters and then call AddXY() to
load the series
e.g.
S->AddXY(XValue, YValue, caption.c_str(), clTeeColor);
and finally show the graph
e.g.
S->ParentChart = mChart;

Another post recommends using either OnGetAxisLabel but this will not work when my Axis Labels are Values?
The other suggestion was to model after the 6.01 custom labels feature using: TChartAxis *axis = Chart1->Axes->Left;
but I do not see how to coerce S or mChart (in sample code above) to have Axes as a member.

Posted: Wed Sep 01, 2004 7:59 am
by Pep
Hi Jeff,
Another post recommends using either OnGetAxisLabel but this will not work when my Axis Labels are Values?
Yes, it should work in the same manner. You can change the axis labels although they are Values.
The other suggestion was to model after the 6.01 custom labels feature using: TChartAxis *axis = Chart1->Axes->Left;
but I do not see how to coerce S or mChart (in sample code above) to have Axes as a member.
I'm able to have it using the following code :

Code: Select all

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include <Chart.hpp>
#include <Series.hpp>
#include <TeEngine.hpp>
#include <TeeProcs.hpp>
#include <TeeTools.hpp>
#include <TeeFunci.hpp>


//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  TChart *chart = new TChart(this);
  chart->Parent = this;
  chart->Align = alClient;

  TLineSeries *ser = new TLineSeries(chart);
  ser->ParentChart = chart;
  ser->FillSampleValues(10);

  TCursorTool *MyCursor= new  TCursorTool(chart);
  MyCursor->ParentChart=chart;
  MyCursor->FollowMouse= True;


  TLineSeries *tmpLineSeries = new TLineSeries(chart);
  TAverageTeeFunction  *func = new TAverageTeeFunction(chart);
  tmpLineSeries->SetFunction(func);

  chart->Axes->Bottom->SetMinMax(0,3);
}