B4J Question jCharts

Informatix

Expert
Licensed User
Longtime User
Hello

I'm doing my first steps with B4J and I love it. I'm creating an app for runners and I need a charts library. I'm not fond of what I saw in the forum, for various reasons (e.g. I don't want an online solution or I need specific features), so I created my own library (it is very similar to what Stevel05 did as it is also based on javafx.scene.chart but I don't use JavaObject).

In the zip, you will find the compiled library, a demo and the lib source code.

Now the questions:
- I'm not familiar with B4J so I'd like to know if I wrote my library and my demo as they should be done;
- I'd like to display a tooltip when my mouse is over a plotted data. How would you do this tooltip (with an existing view? which one? or by drawing it?)?
- I'd like to display a crosshair when my mouse is on a chart and this crosshair would be drawn on the closest data item. What's the best method to draw two lines and a circle over a view?

Thanks in advance for your answers.
 

Attachments

  • jCharts.zip
    34.2 KB · Views: 400

inakigarm

Well-Known Member
Licensed User
Longtime User
- Tooltip: From this post
B4X:
'JavaFX API Reference: http://download.java.net/jdk8/jfxdocs/javafx/scene/control/Tooltip.html
Sub ToolTipToLineChart(lc As LineChart , msg As String)
    Dim joToolTip As JavaObject
    Dim joToolTip2 As JavaObject = joToolTip.InitializeNewInstance("javafx.scene.control.Tooltip", Array(msg))
    joToolTip.RunMethod("install", Array(lc, joToolTip2))
End Sub
Add
B4X:
ToolTipToLineChart(LineChart,XAxis.GetValueForDisplay(AxisCoord.X) &"/"&YAxis.GetValueForDisplay(AxisCoord.Y))
on LCP_MouseMoved

- With canvas maybe ?? (also you can change the cursor mouse when it's over a view)
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
- Tooltip: From this post
B4X:
'JavaFX API Reference: http://download.java.net/jdk8/jfxdocs/javafx/scene/control/Tooltip.html
Sub ToolTipToLineChart(lc As LineChart , msg As String)
    Dim joToolTip As JavaObject
    Dim joToolTip2 As JavaObject = joToolTip.InitializeNewInstance("javafx.scene.control.Tooltip", Array(msg))
    joToolTip.RunMethod("install", Array(lc, joToolTip2))
End Sub
Add
B4X:
ToolTipToLineChart(LineChart,XAxis.GetValueForDisplay(AxisCoord.X) &"/"&YAxis.GetValueForDisplay(AxisCoord.Y))
on LCP_MouseMoved

- With canvas maybe ?? (also you can change the cursor mouse when it's over a view)
I didn't find a library suitable for my needs. javafx.scene.control.Tooltip appears too late on screen and you cannot change this delay. The two available notifications library are not exactly what I'm after and InfoOverlay is locked to the bottom. So I think I will display a simple Pane with a few labels.
 
Upvote 0
Top