Hi,
If you want your date to be visible only in tooltip, and assign xAxis to one value and yAxis to second one you can use seriesMapping in data module and tooltip formatter for displaying your data in tooltip.
Code: Select all
const csv = `Date,stock A,stock B
2021/1/01,10,15
2021/2/01,12,10`
const options = {
xAxis: {
type: 'linear'
},
chart: { type: 'scatter' },
tooltip: {
useHTML: true,
formatter () {
const chart = this.series.chart
const series = chart.series
const seriesText = `Stock A: ${this.x}<br>Stcok B: ${this.y}`
const dateText = 'Date: ' + (new Date(this.point.date)).toISOString().slice(0, 10) + '<br>'
return dateText + seriesText
}
},
data: {
csv,
seriesMapping: [{ x: 1, y: 2, name: 1, date: 0 }]
},
}
const chart = Highcharts.chart('container', options)
Live example:
https://jsfiddle.net/3eoe36nw/
Regards.