'Can a String be used as a value in series of Echarts

My JSON looks like this:-

{
 "date": "2021-11-02T11:09:10.000+00:00"
"classification": "Internal",
}

And I want to plot "date" on X-axis and "classification" as a value in the Series. But there is no way I found to plot it as a value.

Any suggestions??



Solution 1:[1]

I'm not sure what you are looking for.. but you can set the yAxis type also to "category":

option = {
  dataset: {
    source: [
      {
        date: '2021-11-02T11:09:10.000+00:00',
        classification: 'Internal'
      },
      {
        date: '2021-11-03T11:09:10.000+00:00',
        classification: 'External'
      }
    ]
  },
  xAxis: {
    type: 'category'
  },
  yAxis: {
    type: 'category'
  },
  series: [
    {
      encode: {
        x: 'date',
        y: 'classification'
      },
      type: 'line'
    }
  ]
};

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Oliver