1

I'm using Embarcadero's HTML5 builder (php) and TeeChart to draw graphs. Works beautifully for most parts. The TeeChart documentation for php is however pretty sparse to say at least - lots of trial and errors. I can't find a way to set the pen thickness for a line graph. Nothing on Google. Anyone out there who knows?

Also, if one uses a Bar graph, one would think following code snippet should disable the annotating marks over each bar:

$series1=$this->Chart2->addSeries(new TeeBar($this));
$series1->Marks->Visible = false;

It doesn't. Marks->Visible doesn't do anything. The default marks are still displayed.

Kromster
  • 7,181
  • 7
  • 63
  • 111
MagnusBolm
  • 11
  • 2

1 Answers1

1

If you are using TeeChart for PHP in HTML5 Builder XE3:

I can't find a way to set the pen thickness for a line graph. Nothing on Google. Anyone out there who knows?

If you take the features demo included with the installation as reference, you'll find the Line2D example in it. After creating the chart:

$chart = new TChart(500,300);

The Line series are added and populated:

$line1=new Line($chart->getChart());  
$data = Array(10,50,25,175,125,200,175);
$line1->addArray($data);

$line2=new Line($chart->getChart());  
$line2->addXY(0,10);
$line2->addXY(1,15);
$line2->addXY(2,20);
$line2->addXY(3,25);                                       
$line2->addXY(10,30);

$line3=new Line($chart->getChart());  
$data = Array(200,175,175,100,65,110,90);
$line3->addArray($data);

Then, to make them wider, you can just:

$line1->getLinePen()->setWidth(2);
$line2->getLinePen()->setWidth(2);
$line3->getLinePen()->setWidth(2);

Or you could use the foreach loop already present:

foreach ($chart->getSeries() as $serie) {
  //...

  $serie->getLinePen()->setWidth(2);
}

Also, if one uses a Bar graph, one would think following code snippet should disable the annotating marks over each bar:

$series1=$this->Chart2->addSeries(new TeeBar($this));
$series1->Marks->Visible = false; 

Tt doesn't. Marks->Visible doesn't do anything. The default marks are still displayed.

Take a look at the Bar series example. It starts like this:

$chart1 = new TChart(500,300);

$chart1->getChart()->getHeader()->setText("Bar Style");
$chart1->getChart()->getAspect()->setChart3DPercent(30);

$bar=new Bar($chart1->getChart());
$chart1->getChart()->getSeries(0)->setColorEach(true);
$chart1->getChart()->getSeries(0)->fillSampleValues(10);

And you can see the marks in the first Bar chart. But adding the following to the above seems to hide the marks as expected for me here:

$chart1->getChart()->getSeries(0)->getMarks()->setVisible(false);

The same could be done just like this:

$bar->getMarks()->setVisible(false);

If you are using TeeChart HTML5/JavaScript in HTML5 Builder XE3:

I can't find a way to set the pen thickness for a line graph. Nothing on Google. Anyone out there who knows?

You can do it through the format.stroke.size property, as follows:

var Chart1;

function draw() {
  Chart1=new Tee.Chart("canvas1");

  line1=Chart1.addSeries(new Tee.Line());
  line1.addRandom(25);
  line1.format.stroke.size=2;

  line2=Chart1.addSeries(new Tee.Line());
  line2.addRandom(25);

  Chart1.draw();
}

Also, if one uses a Bar graph, one would think following code snippet should disable the annotating marks over each bar:

$series1=$this->Chart2->addSeries(new TeeBar($this));
$series1->Marks->Visible = false; 

Tt doesn't. Marks->Visible doesn't do anything. The default marks are still displayed.

This seems to work as expected for me here:

var Chart1;

function draw() {
  Chart1=new Tee.Chart("canvas1");

  bar1=Chart1.addSeries(new Tee.Bar());
  bar1.addRandom(6);
  bar1.marks.visible=false;

  bar2=Chart1.addSeries(new Tee.Bar());
  bar2.addRandom(6);

  Chart1.draw();
}
Yeray
  • 5,009
  • 1
  • 13
  • 25
  • Tks Yeray. It seems however that the TeeChart shipped with Embarcadero's RAD Studio XE3 for HTML5 builder is somewhat limited. When I run the code with $line1->getLinePen()->setWidth(2); – MagnusBolm Jun 28 '13 at 18:45
  • Again: Tks Yeray. It seems however that the TeeChart shipped with Embarcadero's RAD Studio XE3 for HTML5 builder is somewhat limited. When I run the code with $line1->getLinePen()->setWidth(2); I get following error: Fatal error: Call to a member function getMarks() on a non-object in C:\Users\Magnus B\Documents\HTML5 Builder\Projects\LS_user\MainUnit.php on line 97. Same error occurs if I disables Marks with getMarks – MagnusBolm Jun 28 '13 at 18:48
  • I thought you were using TeeChart for PHP instead of TeeChart HTML5. I've edited the answer with a second part. I hope it helps! – Yeray Jul 02 '13 at 15:31