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:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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:
Post a Comment