TeeChart for PHP:图像呈现和JavaScript导出之间的差异
我尝试在PHP中使用TeeChart的右轴。我知道我们需要将一个有效的系列链接到两个垂直轴。事实上,我在Steema站点上尝试了一个简单的测试,其中包括定制axis演示。我剪切并粘贴了演示,并尝试将其导出到javascript,而不是呈现它。 我使用以下代码导出到javascript:TeeChart for PHP:图像呈现和JavaScript导出之间的差异,php,teechart,Php,Teechart,我尝试在PHP中使用TeeChart的右轴。我知道我们需要将一个有效的系列链接到两个垂直轴。事实上,我在Steema站点上尝试了一个简单的测试,其中包括定制axis演示。我剪切并粘贴了演示,并尝试将其导出到javascript,而不是呈现它。 我使用以下代码导出到javascript: echo $tChart1->getChart()->getExport()->getImage()->getJavaScript()->Render()->toString
echo $tChart1->getChart()->getExport()->getImage()->getJavaScript()->Render()->toString();
是2个并排呈现的快照(很抱歉将其放在链接中,此论坛不允许我发布图片…)
有没有办法获得正确的轴来显示输出
编辑:
以下是您要测试的代码:
<?php
//Includes
include "../../../sources/TChart.php";
$chart1 = new TChart(600,450);
$chart1->getChart()->getHeader()->setText("Custom Axes Demo");
$chart1->getAspect()->setView3D(false);
$line1 = new Line($chart1->getChart());
$line2 = new Line($chart1->getChart());
$line1->setColor(Color::RED());
$line2->setColor(Color::GREEN());
$chart1->addSeries($line1);
$chart1->addSeries($line2);
// Speed optimization
$chart1->getChart()->setAutoRepaint(false);
for($t = 0; $t <= 10; ++$t) {
$line1->addXY($t, (10 + $t), Color::RED());
if($t > 1) {
$line2->addXY($t, $t, Color::GREEN());
}
}
$chart1->getAxes()->getLeft()->setStartPosition(0);
$chart1->getAxes()->getLeft()->setEndPosition(50);
$chart1->getAxes()->getLeft()->getAxisPen()->color = Color::RED();
$chart1->getAxes()->getLeft()->getTitle()->getFont()->setColor(Color::RED());
$chart1->getAxes()->getLeft()->getTitle()->getFont()->setBold(true);
$chart1->getAxes()->getLeft()->getTitle()->setText("1st Left Axis");
$chart1->getAxes()->getTop()->getLabels()->setAngle(45);
$chart1->getAxes()->getTop()->getTitle()->getFont()->setColor(Color::YELLOW());
$chart1->getAxes()->getTop()->getTitle()->getFont()->setBold(true);
$chart1->getAxes()->getBottom()->getLabels()->setAngle(0);
$chart1->getAxes()->getRight()->getLabels()->setAngle(45);
$chart1->getAxes()->getBottom()->getTitle()->getFont()->setColor(new Color(255,25,25));
$chart1->getAxes()->getBottom()->getTitle()->getFont()->setBold(true);
$chart1->getAxes()->getRight()->getTitle()->getFont()->setColor(Color::BLUE());
$chart1->getAxes()->getRight()->getTitle()->getFont()->setBold(true);
$chart1->getAxes()->getRight()->getTitle()->setText("OtherSide Axis");
$chart1->getAxes()->getRight()->getLabels()->getFont()->setColor(Color::BLUE());
$chart1->getAxes()->getRight()->getAxisPen()->setColor(Color::BLUE());
$chart1->getAxes()->getTop()->getTitle()->setText("Top Axis");
$chart1->getAxes()->getBottom()->getTitle()->setText("Bottom Axis");
$line1->setHorizontalAxis(HorizontalAxis::$BOTH);
$line1->setVerticalAxis(VerticalAxis::$BOTH);
$axis1 = new Axis(false, false, $chart1->getChart());
$chart1->getAxes()->getCustom()->add($axis1);
$line2->setCustomVertAxis($axis1);
$axis1->setStartPosition(50);
$axis1->setEndPosition(100);
$axis1->getTitle()->getFont()->setColor(Color::GREEN());
$axis1->getTitle()->getFont()->setBold(true);
$axis1->getTitle()->setText("Extra Axis");
$axis1->getTitle()->setAngle(90);
$axis1->setRelativePosition(20);
$axis1->getAxisPen()->setColor(Color::GREEN());
$axis1->getGrid()->setVisible(false);
echo $tChart1->getChart()->getExport()->getImage()->getJavaScript()->Render()->toString();?>
我修改了测试页面的结尾,在同一页面上同时显示HTML5和PHP图表:
echo $chart1->getChart()->getExport()->getImage()->getJavaScript()->Render()->toString();
$chart1->render("chart1.png");
$rand=rand();
print '<img src="chart1.png?rand='.$rand.'">';
echo$chart1->getChart()->getExport()->getImage()->getJavaScript()->Render()->toString();
$chart1->render(“chart1.png”);
$rand=rand();
打印“”;
然后,我修改了TeeChart PHP源代码,以导出自定义轴和赋值
现在看起来是这样的:
请发邮件到“info@steema.com“我们将向您发送修改后的单元(JavaScriptExport.php)。我没有权利看到快照现在每个人都应该有访问权限。抱歉,第一次使用谷歌硬盘访问管理。我明白了。你能不能安排一个简单的测试项目,我们可以按原样运行,在这里重现这个问题?@Yeray请看我在原始帖子上的编辑。。。