mirror of
https://github.com/Relintai/pandemonium_engine_easy_charts.git
synced 2024-11-20 10:47:22 +01:00
add BarChart
This commit is contained in:
parent
4983f61f5c
commit
af4389ffa6
12
addons/easy_charts/utilities/classes/plotting/bar.gd
Normal file
12
addons/easy_charts/utilities/classes/plotting/bar.gd
Normal file
@ -0,0 +1,12 @@
|
||||
extends Reference
|
||||
class_name Bar
|
||||
|
||||
var rect: Rect2
|
||||
var value: Pair
|
||||
|
||||
func _init(rect: Rect2, value: Pair = Pair.new()) -> void:
|
||||
self.value = value
|
||||
self.rect = rect
|
||||
|
||||
func _to_string() -> String:
|
||||
return "Value: %s\nRect: %s" % [self.value, self.rect]
|
@ -18,9 +18,8 @@ var bounding_box: bool = true
|
||||
var grid: bool = false
|
||||
var ticks: bool = true
|
||||
var labels: bool = true
|
||||
var origin: bool = true
|
||||
var origin: bool = false
|
||||
var points: bool = true
|
||||
var lines: bool = true
|
||||
var interactive: bool = false
|
||||
|
||||
var use_splines: bool = false
|
||||
@ -33,6 +32,7 @@ var colors: Dictionary = {
|
||||
|
||||
var point_radius: float = 3.0
|
||||
var line_width: float = 1.0
|
||||
var bar_width: float = 10.0
|
||||
var shapes: Array = [Point.Shape.CIRCLE, Point.Shape.SQUARE, Point.Shape.TRIANGLE, Point.Shape.CROSS]
|
||||
var font: BitmapFont = Label.new().get_font("")
|
||||
|
||||
|
@ -12,7 +12,7 @@ enum Shape {
|
||||
var position: Vector2
|
||||
var value: Pair
|
||||
|
||||
func _init(position: Vector2, value: Pair) -> void:
|
||||
func _init(position: Vector2, value: Pair = Pair.new()) -> void:
|
||||
self.value = value
|
||||
self.position = position
|
||||
|
||||
|
@ -7,12 +7,19 @@ or of a Vector2 (ex. `var v2: Vector2 = Vector2(0.6, 0.8)`).
|
||||
extends Reference
|
||||
class_name Pair
|
||||
|
||||
var left: float
|
||||
var right: float
|
||||
var left
|
||||
var right
|
||||
|
||||
func _init(left: float = 0.0, right: float = 0.0) -> void:
|
||||
func _init(left = null, right = null) -> void:
|
||||
self.left = left
|
||||
self.right = right
|
||||
|
||||
func _format(val) -> String:
|
||||
var format: String = "%s"
|
||||
match typeof(val):
|
||||
TYPE_REAL:
|
||||
"%.2f"
|
||||
return format % val
|
||||
|
||||
func _to_string() -> String:
|
||||
return "[%.2f, %.2f]" % [self.left, self.right]
|
||||
return "[%s, %s]" % [_format(self.left), _format(self.right)]
|
||||
|
Loading…
Reference in New Issue
Block a user