geoscript-groovy icon indicating copy to clipboard operation
geoscript-groovy copied to clipboard

Scatter chart doesn't use name to name series

Open moovida opened this issue 6 years ago • 4 comments

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.

moovida avatar Jun 04 '18 13:06 moovida

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!

jericks avatar Jun 07 '18 01:06 jericks

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:

chart_problem

Ignore the wrong legend (Values), since that is what you already fixed, but I have the old lib.

Problems:

  1. 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.
  2. 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!

moovida avatar Jun 07 '18 07:06 moovida

Hmm, I think I see one of the issues, legend, tooltips, and smooth should be booleans not strings.

jericks avatar Jun 08 '18 03:06 jericks

Just on a sidenote, changing the above to boolean doesn't solve the issue.

moovida avatar Apr 06 '19 09:04 moovida