I'm struggling with incorporating date-converted unix timestamps as values in my ECharts graph. The x-axis of my chart is meant to display the recording time for each buy or sell price, represented by respective lines. Everything functions properly when I use the raw timestamp (e.g. 1627353870000), but once I try to change the x-axis type to 'time', it transforms into a strange linear graph as shown below.
Data representation using timestamp
Incorrect display with 'time' type set
This snippet represents the key code block I am tackling:
var buy_price = {
title: {
text: 'Prices Comparison Chart'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['Buy Price', 'Sell Price']
},
xAxis: {
type: 'time', // problematic line (displays correctly without this)
data: [1627353870000, 1627353810000, 1627353820000, 1627353830000]
},
yAxis: [{ min: 1,
max: 100,
type: 'value'
}],
series: [{
name: 'Buy Price',
type: 'line',
symbol: 'none',
data: [2, 4, 6, 8]
},
{
name: 'Sell Price',
type: 'line',
symbol: 'none',
data: [1, 2, 3, 4]
}]
};
I'm at a loss here; there doesn't seem to be adequate support available online for solving this issue within this library.