我有一個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上顯示小數點