Open chaojian-zhang opened 9 months ago
In the meantime, I figured out a simple setup by utilizing examples, though as examples uses a "control" scene (aka. res://addons/easy_charts/control_charts/
), I am not sure whether it's the most efficient way to utilize this addon:
res://addons/easy_charts/control_charts/chart.tscn
as a node/controlextends Control
@onready var chart: Chart = $VBoxContainer/Chart
func _ready():
# Y values can be n-size array of arrays.
# x.size() == y.size() or`x.size() == y[n].size()
var x: PackedFloat32Array = ArrayOperations.multiply_float(range(-10, 11, 1), 0.5)
var y: Array = ArrayOperations.multiply_int(ArrayOperations.cos(x), 20)
# More like chart properties, which can be distinct from trace properties
var properties: ChartProperties = ChartProperties.new()
properties.colors.frame = Color("#161a1d")
properties.colors.background = Color.TRANSPARENT
properties.colors.grid = Color("#283442")
properties.colors.ticks = Color("#283442")
properties.colors.text = Color.WHITE_SMOKE
properties.draw_bounding_box = false
properties.title = "Air Quality Monitoring"
properties.x_label = "Time"
properties.y_label = "Sensor values"
properties.x_scale = 5
properties.y_scale = 10
properties.interactive = true # false by default, it allows the chart to create a tooltip to show point values and interecept clicks on the plot
var options = Function.new( # Function is a weird name for trace options
x, y, "Pressure",
{
color = Color("#36a2eb"),
marker = Function.Marker.CIRCLE,
type = Function.Type.LINE,
interpolation = Function.Interpolation.STAIR
}
)
chart.plot([options], properties)
The scene looks like this:
The setup is available here: https://github.com/Charles-Zhang-Godot/Sample_Plotting_with_EasyChart/tree/main/templates/line_chart_template
Hi, and welcome. Thank you for your effort! I'm sorry about the lack of documentation. I'm not able to provide one at the moment due to personal business and the fact that this is still a "work in progress" project. So any suggestion is always welcomed. I'll make sure to start recording a couple of videos as a getting started guide.
Videos would be helpful! Thanks again for sharing!
you are welcome! thank you.
Describe the solution you'd like Thanks for the library! The functionalities seems promising and the examples are cool but I have difficulty setting things up from scratch. In below I am referring to Godot 4.2
Describe an implementation suggestion From the Wiki page https://github.com/fenix-hub/godot-engine.easy-charts/wiki/Static-and-Dynamic-data-plotting-with-PieChart it mentioned two functions
plot_from_csv()
andplot_from_array()
- but none of those exist in the current code base at all. Can you please update the wiki with a very basic Getting Started - in an empty Godot project, how does one add and make use of your library, e.g. to draw a simple line chart? Thanks!Additional context