B4J Question [Solved] - Using JChart - BarChart and StackedBarCharts

Nokia

Active Member
Licensed User
Longtime User
I'm wanting to show BarChart Data and StackedBarChart data like PieData, I want to show the total value of each data section. any code examples?

B4X:
Sub BarChart_MouseMoved(Event As MouseEvent)
    Dim BC As BarChart = Sender

    Dim AxisCoord As XYCoord = BC.MouseToAxis(Event)
    Dim XAxis As CategoryAxis = BC.XAxis
    Dim YAxis As CategoryAxis = BC.YAxis
    Dim XValue As String = XAxis.GetValueForDisplay(AxisCoord.X)
    Dim YValue As Double = YAxis.GetValueForDisplay(AxisCoord.Y)
    lbDashboardInfo.Text = BC.Title & ", " & XValue & " = " & NumberFormat(YValue, 1, 0)
    
End Sub

I'm showing in lable: ChartName, Column, Legend = Value
 

Attachments

  • BarChart.PNG
    BarChart.PNG
    12.7 KB · Views: 261
  • StackedBarChart.PNG
    StackedBarChart.PNG
    22.8 KB · Views: 241

Nokia

Active Member
Licensed User
Longtime User
Solved my issue..

B4X:
Sub BarChart_MouseMoved(Event As MouseEvent)
    Dim BC As BarChart = Sender   
    Dim AC As XYCoord = BC.MouseToData(Event)
    
    If AC = Null Then
        lbDashboardInfo.Text = QVdashText
    Else
        lbDashboardInfo.Text = BC.Title & ", " & AC.X & " = " & NumberFormat(AC.Y, 0, 2)
    End If   
End Sub
 
Upvote 0
Top