简体   繁体   English

更改teechart中的笔厚度为PHP

[英]Change pen thickness in teechart for php

I'm using Embarcadero's HTML5 builder (php) and TeeChart to draw graphs. 我正在使用Embarcadero的HTML5构建器(php)和TeeChart绘制图形。 Works beautifully for most parts. 对于大多数零件,效果很好。 The TeeChart documentation for php is however pretty sparse to say at least - lots of trial and errors. 但是,至少可以说php的TeeChart文档很少-大量的试验和错误。 I can't find a way to set the pen thickness for a line graph. 我找不到设置线图笔粗的方法。 Nothing on Google. 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. Marks->Visible不会执行任何操作。 The default marks are still displayed. 默认标记仍会显示。

If you are using TeeChart for PHP in HTML5 Builder XE3: 如果您在HTML5 Builder XE3中使用TeeChart for PHP

I can't find a way to set the pen thickness for a line graph. 我找不到设置线图笔粗的方法。 Nothing on Google. 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. 如果将安装随附的功能演示作为参考,则会在其中找到Line2D示例。 After creating the chart: 创建图表后:

$chart = new TChart(500,300);

The Line series are added and populated: Line系列已添加并填充:

$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循环:

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. Tt没有。 Marks->Visible doesn't do anything. Marks-> Visible不会执行任何操作。 The default marks are still displayed. 默认标记仍会显示。

Take a look at the Bar series example. 看一下Bar系列示例。 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: 如果您在HTML5 Builder XE3中使用TeeChart HTML5 / JavaScript

I can't find a way to set the pen thickness for a line graph. 我找不到设置线图笔粗的方法。 Nothing on Google. Google上没有任何内容。 Anyone out there who knows? 有人知道吗?

You can do it through the format.stroke.size property, as follows: 您可以通过format.stroke.size属性执行此操作,如下所示:

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. Tt没有。 Marks->Visible doesn't do anything. Marks-> Visible不会执行任何操作。 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();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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