我有一个Oracle查询返回格式为Y-m-d H:i:s的日期字符串,我需要将它们传递给Series::AddXY method
。我怎样才能做到这一点?在XAxis上使用TeeChart DateTime
0
A
回答
0
的问题是,我没有固定的时间间隔,我不能用一个“时间机器”在蜡烛的例子。
(X值)我有来自于Oracle查询时间:
$query = "SELECT ptm.IDENTIFICACAO,
mtr.SERIAL,
TO_CHAR(rtu.DATAHORA, 'yyyy-mm-dd hh24:mi:ss') AS DATAHORA,
所以DateTime值是在PHP日期格式的字符串:年月日H:I:S,我需要转换到TChart值。我不知道我是否完全正确的,但它 似乎如下DateTime值应输入为浮点值(UNIX时间戳)
所以我把它们转换:
while(($row = oci_fetch_array($stmt, OCI_ASSOC)) != false){
$thetime = DateTime::createFromFormat('Y-m-d H:i:s', $row["DATAHORA"]);
if($thetime)
$tchart->getChart()->getSeries(0)->addXY((float) $thetime->getTimestamp() , $row["ENERTOT"]/1000);
}
++$rowCount;
}
我希望这可以帮助其他人。
此致敬礼。
1
产品附带的功能演示中的“CandleChart.php”示例在水平轴上使用DateTimes。
这里的变化:
<?php
//Includes
include "../../../../sources/TChart.php";
$chart1 = new TChart(600,450);
$chart1->getChart()->getHeader()->setText("Candle Style");
$chart1->getChart()->getAspect()->setView3D(false);
// Clip Series points
$chart1->getChart()->getAspect()->setClipPoints(true);
$chart1->getChart()->getLegend()->setVisible(false);
// Add Candle data using doubles for date values
$today = time();
$day = 86400;
$hour = 3600;
$chart1->getAxes()->getBottom()->setIncrement(DateTimeStep::$ONEMINUTE);
$chart1->getAxes()->getBottom()->getLabels()->setDateTimeFormat('d/m/Y H:i:s');
$chart1->getAxes()->getBottom()->getLabels()->setAngle(90);
$candle=new Candle($chart1->getChart());
$chart1->setAutoRepaint(false);
for ($i=$today;$i<($today+$hour);$i+=60) {
$candle->addCandle($i,rand(0,100),rand(0,100),rand(0,100),rand(0,100));
}
$chart1->setAutoRepaint(true);
$chart1->doInvalidate();
$chart1->render("chart1.png");
$rand=rand();
print '<font face="Verdana" size="2">Candle Chart Style<p>';
print '<img src="chart1.png?rand='.$rand.'">';
?>
相关问题
- 1. Highcharts xaxis datetime zoom
- 2. Highcharts,在datetime xaxis类型上显示特定的刻度
- 3. DateTime xAxis标签不显示正确
- 4. R:在x轴上使用datetime的ggplot
- 5. MPAndroidChart分组BarChart在Xaxis上被切断
- 6. Highstock折线图xAxis datetime被抽样下降
- 7. Highcharts xAxis
- 8. 如何在TeeChart中绘制垂直线?
- 9. TeeChart VCL vs .NET
- 10. PERL,Tkx和TeeChart
- 11. 在TeeChart中绘制Graphics3D
- 12. 的JavaScript的TeeChart区系列上边框
- 13. 使用D3的静态xAxis订单
- 14. 在Python中使用datetime
- 15. 在MVC中使用DateTime
- 16. 在Elixir中使用datetime
- 17. 在scala中使用datetime/timestamp
- 18. 在C中使用datetime#
- 19. 在DateTime中使用Moles
- 20. 使用datetime列
- 21. 如何在经典ASP中使用TeeChart生成条形图
- 22. 是否有可能在C++中使用.NET版本的TeeChart?
- 23. 在Teechart中使用Linepen,线刷和台阶
- 24. 的TeeChart为MonoDroid的
- 25. TeeChart ActiveX 7问题
- 26. 如何在Highcharts中的xAxis上显示年度值
- 27. MPAndroidChart中的DateTime轴
- 28. 使用datetime和使用python
- 29. Xaxis上显示的滴答数量
- 30. Highcharts每年xAxis上显示小数点