Monday, January 01, 2024

Graphs and Charts 0.2.2 (Bar Chart for Glimmer DSL for LibUI)

Graphs and Charts 0.2.x adds a new Bar Chart Custom Control for Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development Cross-Platform Native GUI Library) in addition to the existing Line Graph Custom Control.

GitHub Repo: https://github.com/AndyObtiva/glimmer-libui-cc-graphs_and_charts

Basic Bar Chart Example:

Screenshot:



Code:

# Source: https://github.com/AndyObtiva/glimmer-libui-cc-graphs_and_charts
require 'glimmer-dsl-libui'
require 'glimmer/view/bar_chart'
class BasicBarChart
include Glimmer::LibUI::Application
body {
window('Basic Bar Chart', 900, 300) { |main_window|
@bar_chart = bar_chart(
width: 900,
height: 300,
x_axis_label: 'Month',
y_axis_label: 'New Customer Accounts',
values: {
'Jan' => 30,
'Feb' => 49,
'Mar' => 58,
'Apr' => 63,
'May' => 72,
'Jun' => 86,
'Jul' => 95,
'Aug' => 100,
'Sep' => 84,
'Oct' => 68,
'Nov' => 52,
'Dec' => 36,
},
)
on_content_size_changed do
@bar_chart.width = main_window.content_size[0]
@bar_chart.height = main_window.content_size[1]
end
}
}
end
BasicBarChart.launch

Glimmer On!!!

No comments: