Display bar chart with thumbnails in yAxis instead of label
I am using this library in my project.
I want to display bar chart with thumbnails. I need to display log of banners.
So i will need chart like below just images in axis.
I am not sure it is possible or not with this library.
If anyone has any ideas then please let me know.
https://echarts.apache.org/tutorial.html#Rich%20Text
It works only with data without space & some characters(-,_). Below is my yAxis options
yAxis: {
type: 'category',
inverse: true,
data: ['Full Sunny', 'Cloudy', 'Showers'],
axisLabel: {
formatter: function (value) {
return '{value|' + value + '} {' + value + '| }';
},
margin: 20,
rich: {
value: {
lineHeight: 30,
align: 'center'
},
'Full Sunny': {
height: 40,
align: 'center',
backgroundColor: {
image: weatherIcons.Sunny
}
},
'Cloudy': {
height: 40,
align: 'center',
backgroundColor: {
image: weatherIcons.Cloudy
}
},
'Showers': {
height: 40,
align: 'center',
backgroundColor: {
image: weatherIcons.Showers
}
}
}
}
}
This is result chart

As you can see images displaying in "Cloudy" & "Showers" (without space). But image is not displaying in 'Full Sunny'.
What am i missing here?
@akvaliya You're right. rich doesn't support space in name. We think it make sense since variable name cannot contain space in JavaScript.
In which case must you have space in rich name?
Variable can contain space or any character in javascript.
In json key-value pair can be like var temp = {"Full-Sunny" : any_value}.
Any type of string can be key. it can be accessed by temp["Full-Sunny"].
I have a data with string with space like i have mentioned in question.
Will this issue be resolved in any release? This is a critical bug.
@akvaliya How about converting your string to remove these characters?
Currently, /\{([a-zA-Z0-9_]+)\|([^}]*)\}/g is used for detecting the key. See: https://github.com/ecomfe/zrender/blob/0cc622196d8665f40d02b6156450cc7a87fe3a67/src/contain/text.js#L15
We will change it if we find the reason is common need for others.
Thanks!
Yes i can remove characters. But what about space?
I have data array of companies name. I can't remove space from company name.
I want to display company logo with name. How can i achieve this?
Does 'Company Name {icon|}' work for you?
@Ovilia I want to display company name with icon like i displayed in image in question. I need to know formatter for it. Current formatter is not working with company name containing space or any special characters(like dash -).
See http://www.echartsjs.com/gallery/editor.html?c=treemap-obama around line 135 params.name
See http://www.echartsjs.com/gallery/editor.html?c=treemap-obama around line 135
params.name
Is this still open? The provided URL just redirects me to the root
