geoscript-groovy
geoscript-groovy copied to clipboard
Scatter chart doesn't use name to name series
It seems that Scatter charts do not use name for the series. Instead in the legend always Values appears.
Also, legend: 'false'
in the opts doesn't hide the legend.
I just added a dataLabel property to Scatter plots so you can change it from Values,
https://github.com/geoscript/geoscript-groovy/commit/e5089d0c458fdaca9cb1677771e89b300419507d
but the legend property seems to be working:
https://jericks.github.io/geoscript-groovy-cookbook/#creating-scatter-plot-charts
Keep the feedback coming!
Thank you!
I made a small test script to describe a few little issues:
def max = 100
def chart1Data = []
for(i in 1..max){
chart1Data << [i, Math.pow(i, 2.0)]
}
def opts1 = [
title: 'Chart1',
name: 'Pow2',
xLabel: 'X Values',
yLabel: 'Y Values',
legend: 'true',
tooltips: 'true',
smooth: 'true']
def chart1 = Curve.curve(opts1, chart1Data)
def chart2Data = []
for(i in 1..max){
if(i % 10 == 0 )
chart2Data << [i, i*50.0]
}
def opts2 = [
title: 'Chart2',
name: 'y = x * 50',
xLabel: 'X Values',
yLabel: 'Y Values',
legend: 'true',
tooltips: 'true',
smooth: 'true']
def chart2 = Scatter.scatterplot(opts2, chart2Data)
chart1.overlay([chart2])
chart1.show()
The result is this:
Ignore the wrong legend (Values), since that is what you already fixed, but I have the old lib.
Problems:
- the y axis added to the right for the second series is wrong. It seems to ba a version of the left y axis, but scaled by 10000) . But the data are in the same scale of the first data. If I add other overlays, the same happens for any newly added axis.
- if I put the legend property to false in the opts1 and opts2, the legend doesn't disappear.
It would be great to be able to avoid y axes addition at the right.
Thanks!
Hmm, I think I see one of the issues, legend, tooltips, and smooth should be booleans not strings.
Just on a sidenote, changing the above to boolean doesn't solve the issue.