-1

I don't even know if I am using right English but I really need help

Assuming you have such data for an Echart graph?

option = {
  xAxis: {
    data: ['A', 'B' 'B', 'C', 'D', 'E']
  },
  yAxis: {},
  series: [
    {
      data: [10, 22, 28, 23, 19, 23 ],
      type: 'line',
      smooth: true
    }
  ]
};

How do I plot another point between A and B?

iamafasha
  • 848
  • 10
  • 29

1 Answers1

2

You can add a new data point between "A" and "B" in the x-axis data by splicing the array. For example:

option.xAxis.data.splice(1, 0, "A.5")

This will insert the new data point "A.5" at index 1 (between "A" and "B"). You also need to update the data of your series accordingly.

option.series[0].data.splice(1, 0, 16)

This will insert the value 16 at index 1 (between the value of A and B).

Please keep in mind that if you want to add multiple points you need to do the splicing for the x and y axis data for each point.