Delete ChartContainer2D.gd

This commit is contained in:
Nicolò Santilio 2020-12-21 18:12:05 +01:00 committed by GitHub
parent a171315b6b
commit 9bb96beb41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,40 +0,0 @@
tool
extends Node2D
var LineChart = preload("LineChart2D/LineChart2D.tscn")
var ColumnChart = preload("BarChart2D/BarChart2D.tscn")
export (String,"None","LineChart2D","BarChart2D") var chart_type : String setget set_type,get_type
var chart : Node2D setget set_chart,get_chart
# Called when the node enters the scene tree for the first time.
func _ready():
set_chart(get_child(0))
func set_type(type : String):
chart_type = type
var new_node
if get_children().size():
for child in get_children():
child.queue_free()
if Engine.editor_hint:
match type:
"LineChart2D":
new_node = LineChart.instance()
add_child(new_node)
new_node.set_owner(owner)
"ColumnChart2D":
new_node = ColumnChart.instance()
add_child(new_node)
new_node.set_owner(owner)
"None":
set_chart(null)
func get_type():
return chart_type
func set_chart(ch : Node2D):
chart = ch
func get_chart():
return chart