I want to have a simple line chart made with eCharts where the yAxis labels are not taken by the values of the series, but from an JS array. In example: instead of the values 0 to 100, there should only be three Yaxis labels saying "Zero" at the 0 level, "OK" in the middle of the charts and "Absolutely!" on top of the Yaxis label line.
I took the example below and changed the series to line-types but then i also had to convert the Yaxis type to "category" and there everything went south. LINK: https://ecomfe.github.io/echarts-examples/public/editor.html?c=bar-rich-text
I would love to archive something like this with Echarts: https://i.pinimg.com/originals/e2/6e/81/e26e81d91dbb2b89a58ad0ba84e4004d.png
I started with a simpler graph, and I accomplished what you were looking for:
The main change being the data needs to have the same values as the yAxis' data fields. I imagine this needs to be done outside of echarts. I don't know if there is a way to tell echarts to map particular ranges to a certain yAxis label:
yAxis: {
type: 'category',
data: [0, 'OK', 'Absolutely!']
},
series: [
{
name:'邮件营销',
type:'line',
stack: '总量',
data:[0, 'OK', 'OK', 'OK', 'Absolutely!', 'OK', 'OK']
},
{
name:'联盟广告',
type:'line',
stack: '总量',
data:['OK', 0, 0, 0,0, 'Absolutely!', 'OK']
},
]