Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] (Documentation) Having Real Difficulty Getting Started #99

Open
chaojian-zhang opened this issue Feb 2, 2024 · 4 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@chaojian-zhang
Copy link

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() and plot_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

  • Godot 4.2
  • Easy Chart 14.08.2023 (as downloaded from Asset Lib)
@chaojian-zhang chaojian-zhang added the enhancement New feature or request label Feb 2, 2024
@chaojian-zhang
Copy link
Author

chaojian-zhang commented Feb 2, 2024

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:

  1. Create empty project
  2. Use Asset Lib to download Easy Chart
  3. Duplicate one of the examples to serve as main file
  4. Essentially in a scene we just need to reference res://addons/easy_charts/control_charts/chart.tscn as a node/control
  5. Then in the script we just do the follow for setting up the intended plot
extends 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:

image

The setup is available here: https://github.com/Charles-Zhang-Godot/Sample_Plotting_with_EasyChart/tree/main/templates/line_chart_template

@fenix-hub
Copy link
Owner

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.

@chaojian-zhang
Copy link
Author

Videos would be helpful!
Thanks again for sharing!

@fenix-hub
Copy link
Owner

you are welcome!
thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants