-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some features are not available in custom series #164
Comments
Thanks for the suggestion. Agree we should enhance our docs about custom series. But |
Really? Then I must have misunderstood something. I add itemStyle in the official example, and it didn't work. Check this. |
In this example, |
So here is two conclusions:
Am I right? How about the other properties in |
Oh I discover that I can specify As for the label, it is because I didn't get the styles correctly that I would consider that the My misunderstanding of It turns out that if I continue to use Anyway, my questions are solved generally. There is much work to do with the document though. If you don't have further comments, you can close this issue. Thanks for your patience!😀 |
Since v5, in var option = {
xAxis: {
max: 200
},
yAxis: {
min: 0,
max: 200
},
series: {
type: 'custom',
selectedMode: true,
renderItem: function (params, api) {
return {
type: 'circle',
x: 100,
y: 100,
shape: {
cx: 0, cy: 0, r: 50
},
style: {
fill: 'orange'
},
textContent: {
style: {
text: 'this is a label'
}
},
textConfig: {
// label position
position: 'top'
},
// style for the "selected" state
select: {
style: {
fill: 'blue'
}
},
// style for the "hover" state.
emphasis: {
style: {
fill: 'red'
}
}
}
},
data: [[1]]
}
}; In fact, the final style of a graphic element is always determined by the Because it's not easy to keep completely backward compatibility of |
Thanks for your detailed explanation. I don't know too much about the implementation details, but I'd like to share some thoughts as a user. For me, const series = [{
type: 'custom',
name: 'category1',
renderItem(params, api) {
return {
type: 'rect',
shape: {
// shape settings
},
style: {
fill: api.style().fill // defaultColorList[0]
}
}
}
}, {
type: 'custom',
name: 'category2',
renderItem(params, api) {
return {
type: 'rect',
shape: {
// shape settings
},
style: {
fill: api.style().fill // defaultColorList[1]
}
}
}
}]; Without const series = {
type: 'custom',
renderItem(params, api) {
return {
type: 'rect',
shape: {
// shape settings
},
style: {
fill: api.defaultStyle('item').fill // a color of the default color list
// other custom styles
},
emphasis: api.defaultStyle('emphasis'), // default emphasis styles
blur: api.defaultStyle('blur'), // default blur styles
select: api.defaultStyle('select'), // default select styles
label: {
// default label styles
textStyle: api.defaultStyle('labelText'),
boxStyle: api.defaultStyle('labelBox')
}
}
}
}; The |
In custom series, there are several features not available at all, including itemStyle, labelLine, labelLayout, selectMode, seriesLayoutBy etc. Those sections should be removed. Plus, there is some features that are marked as deprecated in ECharts 5, such as api.style() and api.styleEmphasis(). Those are not documented either.
Since the custom series is kind of a hard part in echarts, I think this part of document need to be reviewed and revised carefully.
The text was updated successfully, but these errors were encountered: