As part of a B4J application I finish up with a table of data consisting of x and y coordinates (both in the range 0 - 100) and for each point value of 1 or 0.
I want to produce a (scatter?) plot of those points, with the shape of the plotted point being determined by whether its value is 1 or 0. For instance 1 could be shown as x and 0 as o, but any distinguishable shape would be OK such as a square and circle.
I'm just looking for a pointer on what method would suit and where to start. I was thinking javafx.scene.shape may be is where I should be.
Thanks again for your great help. I've been able to produce the basic chart:
but can I ask a few questions?
I can't see how the color and shape of the points in each series is set - where is that done?
If the line MainForm.RootPane.AddNode(inline.RunMethod("getChart",Null),10,10,310,310) places the scatter chart in the MainForm, how do I remove the chart so it is not visible, but MainForm remains?
How can I clear the displayed data with the chart framework remaining so i can display new data, presumably by invoking the line inline.RunMethod("addData",Array(x,y,v))?
Would it be possible to set the background of the chart to an image so the scatter points are overlaid on the image?
I can answer some of your questions
1, It is set from css (haven't managed to get this working as I am rubbish at css)
2, You can change the code slightly to allow for this
B4X:
.....
Dim sc As Node
sc = inline.RunMethod("getChart",Null)
MainForm.RootPane.AddNode(sc,10,10,410,410)
You can then remove the node from mainform as normal
3, You can use remove function to get rid of a series
4, Yes you can have an image as a background, again css is used
I thought css may be involved and you've confirmed that for me.
I've been able to produce a css file (and load it) that sets the shape and color of the points and sets the background of the chart to an image. Dimensioning sc as a node has also allowed me to be able to remove it. So now I've just the implementation of the remove function to get rid of the series.