简体   繁体   中英

TeeChart php for HTML5 Builder. How to customize the x-axis

I'm using Embarcadero's HTML5 builder (php) and TeeChart to draw graphs. Great tool for most parts but the TeeChart documentation for HTML5 Builder php is extremely thin, almost nonexisting so you need to guess a lot.

Now, I need a way to format the x-axis in a TeeChart line graph that has 2 series of data. Both series shares the same y and x-axis.The x-axis in my case should be text, not numbers. Now, the default x-axis is numbered 1,2,3... which isn't really workable in most situations.

To format TeeChart's y-axis is easy; the following code does it:

 $this->Chart1->axes->left->automatic = false;
  $this->Chart1->axes->left->minimum = 16;
  $this->Chart1->axes->left->maximum = 28;

one would then think the same logic would apply for the bottom axis, ie

 $this->Chart1->axes->bottom->minimum = something etc...

but not so. You'll get a runtime error trying that manouver.

Someone out there who knows how to get TeeChart php for HTML5 Builder draw an x-axis as you want it to appear?

I've taken the source code from this demo (index page here ) and I've added this at the end of the page, before the render call:

$chart1->axes->bottom->automatic = false;
$chart1->axes->bottom->minimum = -1;
$chart1->axes->bottom->maximum = 11;
$chart1->axes->top->automatic = false;
$chart1->axes->top->minimum = -1;
$chart1->axes->top->maximum = 11;

And it seems to work without problems:

水平轴上的自定义范围

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM