diff --git a/README.md b/README.md index 1212bbd..fe36038 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ A library of Charts plotted in Control, 2D and 3D nodes to visualize general purpose datasets. Author: *"Nicolo (fenix) Santilio"* -Version: *0.4.1* +Version: *0.4.2* Wiki: *[wip]* Godot Version: *3.2stable* @@ -72,8 +72,19 @@ You can get this result: | Function | Description | | ------------- | ------------- | |`plot()`|Plot the selected chart with in editor properties| -|`_plot(source : String, delimiter : String, are_values_columns : bool, x_values : int, invert_xy : bool = false)`|Plot the selected chart with hard coded properties| +|`plot_from_csv(csv_file : String, _delimiter : String = delimiter)`|Plot the selected chart defining the source and delimiter from code| +|`plot_from_array(array : Array)`|Plot the selected chart giving an Array of values as a source| +|`update_plot_data(array : Array)`|Update plot data giving an additional entry to the source| |`get_legend()`|Get the legend of the current chart. Returns an **Array** containing control nodes, which can be added as children | +|*API v2*|*additional functions to define chart's properties from code. Hardcoded properties will overwrite the ones given from editor*| +|`set_chart_name(ch_name : String)`|Set the displayed name of the chart| +|`set_source(source_file : String)`|Set the source of the chart to plot| +|`set_delimiter(delimiter : String)`|Set the delimiter to read data from a CSV file| +|`set_indexes(lb : int = 0, function_names : int = 0)`|Set the optional indexes of chart's data| +|`set_radius(use_height : bool = false, f : float = 0)`|Set the radius of the chart, if it is required. If `use_height` is true, the height of the chart will be used.| +|`set_chart_colors(f_colors : PoolColorArray, o_color : Color, b_color : Color, g_color : Color, h_lines : Color, v_lines : Color)`|Set the colors of the chart| +|`set_chart_fonts(normal_font : Font, bold_font : Font, f_color : Color = Color.white)`|Set fonts and font's color for the chart| +|`set_source(source_file : String)`|Set the source of the chart to plot| | Signals | Description | | ------------- | ------------- | @@ -122,11 +133,11 @@ This library offers a set of charts for each main Godot Node: - LineChart [Control, 2D, wip 3D] - BarChart [Control, 2D, wipr 3D] - ScatterChart [wip Control, wip 2D, 3D] +- Piechart [Control] - RadarChart [Control] *Work in progress*: - Area Chart -- Pie Chart - Donut Chart - Radar Chart - Bubble Chart diff --git a/addons/easy_charts/Utilities/Scripts/Chart.gd b/addons/easy_charts/Utilities/Scripts/Chart.gd index 3af5a09..505ab52 100644 --- a/addons/easy_charts/Utilities/Scripts/Chart.gd +++ b/addons/easy_charts/Utilities/Scripts/Chart.gd @@ -86,7 +86,7 @@ var function_names_index : int = 0 setget set_function_names_index#, get_funct # for radar var use_height_as_radius : bool = false setget set_use_height_as_radius -var radius : float = 150.0 setget _set_radius +var radius : float = 150.0 setget _set_radius,get_radius # for columns var column_width : float = 10 setget set_column_width @@ -457,7 +457,7 @@ func set_radius(use_height : bool = false, f : float = 0): radius = f # !!! API v2 -func set_chart_colors(f_colors : Array, o_color : Color, b_color : Color, g_color : Color, h_lines : Color, v_lines : Color): +func set_chart_colors(f_colors : PoolColorArray, o_color : Color, b_color : Color, g_color : Color, h_lines : Color, v_lines : Color): function_colors = f_colors outline_color = o_color box_color = b_color @@ -499,6 +499,10 @@ func set_use_height_as_radius(b : bool): func _set_radius(r : float): radius = r +func get_radius() -> float: + if use_height_as_radius: return get_size().y/2 + else: return radius + # ! API func set_column_width(f : float): column_width = f diff --git a/addons/easy_charts/plugin.cfg b/addons/easy_charts/plugin.cfg index 71d820b..f79b203 100644 --- a/addons/easy_charts/plugin.cfg +++ b/addons/easy_charts/plugin.cfg @@ -3,5 +3,5 @@ name="EasyCharts" description="" author="Nicolò \"fenix\" Santilio" -version="0.4.1" +version="0.4.2" script="plugin.gd"