Technical Support
🟢 Online now
Hello 👋

How can we help you today?
Contact on WhatsApp
B4X Store
jdashboardUI / Charts & Visualization / JBarChart
Charts & Visualization

JBarChart

Vertical bar chart with animation, per-bar colors, gradient fill, values, grid and an optional line series for combo charts.

Search all jdashboardUI docs
Source
jdashboardUI.b4xlib · Public API only
Store language: en
Reference visual
Documentation reference created from the real component type. It is not an exact screenshot.
REFERENCE
JBarChart REFERENCE

Charts & Visualization · jdashboardUI 23.5 · B4J / JavaFX

Vertical bar chart with animation, per-bar colors, gradient fill, values, grid and an optional line series for combo charts.

The image shown on this page is a documentation reference visual. It is not intended to be a pixel-perfect screenshot; the real result depends on size, theme, colors and data.

Highlights

  • PNG export
  • Configurable animation
  • Configurable grid / axes
  • Gradients
  • Configurable title
  • Click interaction

When to use it

Vertical bar chart with animation, per-bar colors, gradient fill, values, grid and an optional line series for combo charts.

Designer Properties

Property Type Default Description
BarColor Color #FF8A2BE2 Color of the bars (purple as in the image)
ShowMarker Boolean True Shows the values above each bar
MarkerText String API Calls
Animate Boolean True
Duration Int 1000 Duration in milliseconds
ValueSuffix String `` Suffix for bar values (e.g., %, $, etc.)
UseGradient Boolean False Use a gradient fill for the bars
ShowGrid Boolean False Shows or hides the horizontal grid lines
GridColor Color 0xFF64748B Color of the horizontal grid lines
GridInterval Float 0 Interval between grid lines (0 for auto 4 steps)
GridTextColor Color 0xFF64748B Color of the grid Y-axis labels
GridTextBold Boolean False Set to True to make the Y-axis text bold
SmoothCurves Boolean False Draw the optional line series as smooth curves instead of straight segments

Creation and lifecycle

Private JBarChart1 As JBarChart

JBarChart1.Initialize(Me, "JBarChart1")
JBarChart1.AddToParent(Root, 20dip, 20dip, 640dip, 360dip)

Working example

Dim Labels As List
Labels.Initialize2(Array As String("Jan", "Feb", "Mar", "Apr"))
Dim Values As List
Values.Initialize2(Array As Double(42, 65, 51, 88))

JBarChart1.TextTitle = "API Calls"
JBarChart1.setData(Labels, Values)
JBarChart1.ShowGrid = True
JBarChart1.RoundedBars = True
JBarChart1.Suffix = "%"

Normalized B4X properties

Compatible public getX/setX accessors are presented as normal B4X properties. Parameterized accessors remain documented as methods.

Property Access Type
BarWidth read / write Float
BarSpacing read / write Float
ShowAxes read / write Boolean
ShowYAxisValues read / write Boolean
ShowGrid read / write Boolean
GridColor read / write Int
GridInterval read / write Float
GridTextColor read / write Int
GridTextBold read / write Boolean
BarSeriesName write String
ShowLineValues write Boolean
Curves write Boolean
TitleFont write B4XFont
TitleColor write Int
XAxisTextColor write Int
TextTitle write String
Color write Int
Colors write List
ShowValues write Boolean
Suffix write String
Gradient write Boolean
RoundedBars write Boolean

Events

  • MouseClicked

Export and rendering

When the module exposes SaveAsPNG / SavePNG, the rendered control can be saved directly to PNG. Check the returned Boolean when provided.

Source-backed notes for the analyzed version

  • Supports an optional combo line series through setLineSeries, with separate line-value visibility and smooth-curve control.

Complete public API

  • Initialize(Callback As Object, EventName As String)
  • DesignerCreateView(Base As Object, Lbl As Label, Props As Map)
  • AddToParent(Parent As B4XView, Left As Int, Top As Int, Width As Int, Height As Int)
  • setData(PointsX As List, Values As List)
  • setLineSeries(Values As List, SeriesName As String, Color As Int)
  • setBarSeriesName(SeriesName As String)
  • setShowLineValues(Show As Boolean)
  • setCurves(Curves As Boolean)
  • clearLineSeries()
  • setTitleFont(Font As B4XFont)
  • setTitleColor(Color As Int)
  • setXAxisTextColor(Color As Int)
  • setTextTitle(Title As String)
  • setColor(color As Int)
  • setColors(Colors As List)
  • setShowValues(Show As Boolean)
  • setSuffix(Suffix As String)
  • setGradient(Use As Boolean)
  • setBarWidth(Width As Float)
  • getBarWidth() As Float
  • setBarSpacing(Spacing As Float)
  • getBarSpacing() As Float
  • setRoundedBars(Enabled As Boolean)
  • SaveAsPNG(Dir As String, FileName As String, BackgroundColor As Int) As Boolean
  • setShowAxes(Show As Boolean)
  • getShowAxes() As Boolean
  • setShowYAxisValues(Show As Boolean)
  • getShowYAxisValues() As Boolean
  • setShowGrid(Show As Boolean)
  • getShowGrid() As Boolean
  • setGridColor(Color As Int)
  • getGridColor() As Int
  • setGridInterval(Interval As Float)
  • getGridInterval() As Float
  • setGridTextColor(Color As Int)
  • getGridTextColor() As Int
  • setGridTextBold(Bold As Boolean)
  • getGridTextBold() As Boolean
  • JMultiBarChart
  • JStackedBarChart
  • JLineChart