Currently, I am in the process of creating a chart with AmCharts. Specifically, I am focusing on the stocklegend
section.
"stockLegend": {
"valueTextRegular": "[[time]]:[[value]]"
}
In this scenario, the 'time' refers to a Date object that has been converted from a timestamp found within a JSON dataset loaded into a JavaScript object serving as the data provider for the chart (
"dataProvider": consChartData.Data
, where Data is an array containing values and timestamps).
With the current code snippet [[time]]:[[value]]
, my output looks like this:
https://i.sstatic.net/a9F6C.png
However, I would like the format to be: Dec 23 2017, 5:21:00 IST: 17,686.54. Is there a way to achieve this specific formatting for the 'time' variable?
Edit
My attempt to use solutions suggested in How to format a JavaScript date did not yield the desired result. If I apply those methods here, it results in
"valueTextRegular":dateFormat("[[time]]") + "[[value]]"
. However, when I create a new Date object based on the provided time, the output displays:
"NaN undefined NaN 17,686.54"
which is not the expected outcome.