Comments (5)
Hi @dpajkovic , the legend and the data is not in the same system, there is no corresponding legend for each data.
It needs set it individual and bind to the series via name
.
Base on the code you provide:
legends := []map[string]interface{}{
{
"name": "Number of production Events",
"itemStyle": map[string]string{
"color": "#516a91",
},
},
{
"name": "Number of pre-production Events",
"itemStyle": map[string]string{
"color": "#93b7e3",
},
},
{
"name": "Linear regression of production Events",
"itemStyle": map[string]string{
"color": "#516a91",
},
},
{
"name":"Linear regression of pre-production Events",
"itemStyle": map[string]string{
"color": "#93b7e3",
},
}
charts.WithLegendOpts(
opts.Legend{
...
Data: legends,
},
),
from go-echarts.
Interesting. And a nice workaround. But I would argue that it stands to reason the line color should be picked up by the legend from the series setting the same way the type of the line is picked up. Thanks!
from go-echarts.
Interesting. And a nice workaround. But I would argue that it stands to reason the line color should be picked up by the legend from the series setting the same way the type of the line is picked up. Thanks!
FYI.
It is not a workaround, it is literally how it works in echarts
.
By default, the line and the legend both pick the Color from the global Colors
.
When you custom the line
's color individually, it does not impact the global Colors which used by legend.
You can config the global colors via Colors
, but it doesn't means there has a steady corresponding legend color to the lines custom color, although you could set it as the same.
line.Colors = []string{"#ae1029","#0065c2","#26c238", "#9876aa", "#fb8649",
"#57904b","#d35b5c"}.
// line.Colors = []string{"#516a91","#0065c2","#93b7e3"},
from go-echarts.
My argument is that legend picks up the line type (solid/dashed/dotted...), which I declare in LineStyle
same as I do the color, and intuitively it should pick up the color as well. Is there a way to change the line type in legend Data
?
Anyway, since it's the same in echarts
, I can see this being an enhancement and not a bug.
from go-echarts.
My argument is that legend picks up the line type (solid/dashed/dotted...), which I declare in
LineStyle
same as I do the color, and intuitively it should pick up the color as well. Is there a way to change the line type in legendData
?
The line style of echarts
is another topic and its default behavior refer to its doc:
Legend line style. If its children have values as 'inherit', the values are inherited from corresponding series options.
I see the behavior between the legend
and the series
seems odd with some inherit
and something not.
But it is what it is...
Is there a way to change the line type in legend Data?
{
"name": "Number of production Events",
"itemStyle": map[string]string{
"color": "#516a91",
},
// add the lineStyle
lineStyle: {
type: "dashed"
}
}
from go-echarts.
Related Issues (20)
- Tooltip and Y axis label HOT 7
- Overlapping labels in xAxis with type="time" HOT 3
- Formatting go-echart tooltip value HOT 4
- Accessing go-echart instant in the browser HOT 3
- Reconciling v2.4.0-rc2 snipperRender with custom snippet render HOT 6
- [Question] undefined: opts.Bool. Cannot compile due to undefined: opts.Bool HOT 2
- Two questions 1. Is it possible to determine the size of the liquid chart 2. Can I simply display the liquid chart without a legend? HOT 1
- [Question] How to render body only? HOT 3
- [Question] learning Go and Go-Echarts. Question concerning the gauge HOT 2
- Adding JSFuncStr destroys the chart HOT 2
- format value data and tooltip for piechart HOT 1
- Overlaped charts HOT 4
- Possible to customize the size of the line Mark Points? HOT 2
- [Bug] Phantom mark points HOT 2
- [Question] Who to set id for a series? HOT 1
- [Question] Line Chart: how to specify animation duration HOT 2
- [Question] Possible to customize the color of the Mark Points? HOT 8
- [Bug] PageTitle does not work on liquid or gauge charts
- [Bug]cannot use true (untyped bool constant) as "github.com/go-echarts/go-echarts/v2/types".Bool value in struct literal
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-echarts.