![]() | Steema Issues DatabaseNote: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;otherwise you can use StackOverflow. Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy. |
| Summary: | Recognize automatically the datetime data when you export to TeeChart Javascript | ||
|---|---|---|---|
| Product: | VCL TeeChart | Reporter: | sandra pazos <sandra> |
| Component: | Export | Assignee: | Steema Issue Manager <issuemanager> |
| Status: | RESOLVED FIXED | ||
| Severity: | enhancement | CC: | david, r.krause |
| Priority: | High | ||
| Version: | 131119 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Chart Series: | --- | Delphi / C++ Builder RAD IDE Version: | |
| Attachments: | Test project (VCL) | ||
|
Description
sandra pazos
2014-01-27 06:18:11 EST
Partially fixed. Added support for datetime series values when exporting a chart to JavaScript format using TeeJavaScript.pas "TJavaScriptExportFormat" class. See attachment with test VCL project. Note: The latest TeeChart source code (Feb-5th or greater) is required. Pending: DateTime support when exporting to JSON format. Fixed. Added a new property to TSeriesDataJSON class to determine which format to use for datetime values. It seems there's no standard about datetime data in JSON format. http://markembling.info/2011/07/json-date-time So, by default datetime values will be simply exported as timestamps (Delphi date timestamps), and the new property allows exporting to JavaScript Date format (milliseconds since 1-1-1970): uses TeeStore, TeeStringsEditor; procedure TForm1.Button2Click(Sender: TObject); var s : String; begin with TSeriesDataJSON.Create(Chart1) do try DateTimeFormat:=jdJavaScript; s:=AsString; TeeEditStrings(Self,s); finally Free; end; end; However, datetime values in JSON format cannot be imported automatically because the browser JSON parser does not know that numbers are datetime values. So, a conversion should be done in JavaScript from JSON data to valid dates, like: series.data.x[0] = new Date(series.data.x[0]); This will make the chart axes to recognize series data as datetime values. Created attachment 83 [details]
Test project (VCL)
|