﻿B4J=true
Group=Default Group
ModulesStructureVersion=1
Type=Class
Version=10.3
@EndOfDesignText@
#IgnoreWarnings:12

#DesignerProperty: Key: ParentID, DisplayName: Parent ID, FieldType: String, DefaultValue: , Description: Parent ID
#DesignerProperty: Key: TypeOf, DisplayName: Chart Type, FieldType: String, DefaultValue: bar, Description: Chart type (bar, line, pie, etc.), List: area|bar|column|donut|line|pie|polarArea|radar|radialBar|rangeArea|scatter
#DesignerProperty: Key: Title, DisplayName: Title, FieldType: String, DefaultValue: , Description: Chart title
#DesignerProperty: Key: TitleFontSize, DisplayName: Title Font Size, FieldType: String, DefaultValue: 14px, Description: Title font size
#DesignerProperty: Key: Subtitle, DisplayName: Subtitle, FieldType: String, DefaultValue: , Description: Chart subtitle
#DesignerProperty: Key: SubtitleFontSize, DisplayName: Subtitle Font Size, FieldType: String, DefaultValue: 12px, Description: Subtitle font size
#DesignerProperty: Key: Width, DisplayName: Width, FieldType: String, DefaultValue: 100%, Description: Chart width
#DesignerProperty: Key: Height, DisplayName: Height, FieldType: String, DefaultValue: 350px, Description: Chart height
#DesignerProperty: Key: BarLabels, DisplayName: Bar Labels, FieldType: Boolean, DefaultValue: False, Description: Show bar labels
#DesignerProperty: Key: BorderRadius, DisplayName: Border Radius, FieldType: Int, DefaultValue: 4, Description: Border radius
#DesignerProperty: Key: ColumnWidth, DisplayName: Column Width, FieldType: String, DefaultValue: 70%, Description: Column width
#DesignerProperty: Key: Curve, DisplayName: Curve, FieldType: String, DefaultValue: smooth, Description: Line curve, List: smooth|straight|stepline
#DesignerProperty: Key: DashedRadial, DisplayName: Dashed Radial, FieldType: Boolean, DefaultValue: False, Description: Dashed radial bars
#DesignerProperty: Key: DataLabelOrientation, DisplayName: Data Label Orientation, FieldType: String, DefaultValue: horizontal, Description: Data label orientation, List: vertical|horizontal
#DesignerProperty: Key: DataLabelPosition, DisplayName: Data Label Position, FieldType: String, DefaultValue: center, Description: Data label position, List: top|center|bottom
#DesignerProperty: Key: DonutShowTotal, DisplayName: Donut Show Total, FieldType: Boolean, DefaultValue: True, Description: Show total in donut
#DesignerProperty: Key: EndAngle, DisplayName: End Angle, FieldType: Int, DefaultValue: 360, Description: End angle
#DesignerProperty: Key: Gradient, DisplayName: Gradient, FieldType: Boolean, DefaultValue: True, Description: Enable gradient
#DesignerProperty: Key: GridShow, DisplayName: Grid Show, FieldType: Boolean, DefaultValue: True, Description: Show grid
#DesignerProperty: Key: HollowSize, DisplayName: Hollow Size, FieldType: String, DefaultValue: 50%, Description: Hollow size for donut/pie
#DesignerProperty: Key: LegendPosition, DisplayName: Legend Position, FieldType: String, DefaultValue: bottom, Description: Legend position, List: bottom|top|left|right
#DesignerProperty: Key: LegendVisible, DisplayName: Legend Visible, FieldType: Boolean, DefaultValue: True, Description: Legend visible
#DesignerProperty: Key: LineWidth, DisplayName: Line Width, FieldType: Int, DefaultValue: 2, Description: Line width
#DesignerProperty: Key: MarkerSize, DisplayName: Marker Size, FieldType: Int, DefaultValue: 6, Description: Marker size
#DesignerProperty: Key: Realtime, DisplayName: Realtime, FieldType: Boolean, DefaultValue: False, Description: Enable realtime updates
#DesignerProperty: Key: ShowDataLabels, DisplayName: Show Data Labels, FieldType: Boolean, DefaultValue: False, Description: Show data labels
#DesignerProperty: Key: ShowLegend, DisplayName: Show Legend, FieldType: Boolean, DefaultValue: True, Description: Show legend
#DesignerProperty: Key: ShowToolbar, DisplayName: Show Toolbar, FieldType: Boolean, DefaultValue: True, Description: Show toolbar
#DesignerProperty: Key: Sparkline, DisplayName: Sparkline, FieldType: Boolean, DefaultValue: False, Description: Enable sparkline
#DesignerProperty: Key: Stacked, DisplayName: Stacked, FieldType: Boolean, DefaultValue: False, Description: Enable stacking
#DesignerProperty: Key: StartAngle, DisplayName: Start Angle, FieldType: Int, DefaultValue: 0, Description: Start angle
#DesignerProperty: Key: Theme, DisplayName: Theme, FieldType: String, DefaultValue: , Description: Chart theme
#DesignerProperty: Key: TooltipEnabled, DisplayName: Tooltip Enabled, FieldType: Boolean, DefaultValue: True, Description: Enable tooltip
#DesignerProperty: Key: TrackWidth, DisplayName: Track Width, FieldType: String, DefaultValue: 97%, Description: Track width for radial
#DesignerProperty: Key: XAxisTitle, DisplayName: X-Axis Title, FieldType: String, DefaultValue: , Description: X-axis title
#DesignerProperty: Key: XAxisLabelRotate, DisplayName: X-Axis Label Rotate, FieldType: Int, DefaultValue: 0, Description: X-axis label rotation
#DesignerProperty: Key: XAxisLabelRotateOffsetY, DisplayName: X-Axis Label Rotate Offset Y, FieldType: Int, DefaultValue: 25, Description: X-axis label rotate offset Y
#DesignerProperty: Key: XAxisOffsetY, DisplayName: X-Axis Offset Y, FieldType: Int, DefaultValue: 2, Description: X-axis offset Y
#DesignerProperty: Key: XAxisOutputFormat, DisplayName: X-Axis Output Format, FieldType: String, DefaultValue: normal, Description: X-axis output format, List: normal|money|thousand|date|datetime|time
#DesignerProperty: Key: YAxisTitle, DisplayName: Y-Axis Title, FieldType: String, DefaultValue: , Description: Y-axis title
#DesignerProperty: Key: YAxisOutputFormat, DisplayName: Y-Axis Output Format, FieldType: String, DefaultValue: normal, Description: Y-axis output format, List: normal|money|thousand|date|datetime|time
#DesignerProperty: Key: Rounded, DisplayName: Rounded, FieldType: String, DefaultValue: lg, Description: Rounded, List: 0|2xl|3xl|full|lg|md|none|rounded|sm|xl
#DesignerProperty: Key: RoundedBox, DisplayName: Rounded Box, FieldType: Boolean, DefaultValue: False, Description: Rounded Box
#DesignerProperty: Key: Shadow, DisplayName: Shadow, FieldType: String, DefaultValue: lg, Description: Shadow, List: 2xl|inner|lg|md|none|shadow|sm|xl
#DesignerProperty: Key: Visible, DisplayName: Visible, FieldType: Boolean, DefaultValue: True, Description: If visible.
#DesignerProperty: Key: Enabled, DisplayName: Enabled, FieldType: Boolean, DefaultValue: True, Description: If enabled.
#DesignerProperty: Key: PositionStyle, DisplayName: Position Style, FieldType: String, DefaultValue: none, Description: Position, List: absolute|fixed|none|relative|static|sticky
#DesignerProperty: Key: Position, DisplayName: Position Locations, FieldType: String, DefaultValue: t=?; b=?; r=?; l=?, Description: Position Locations
#DesignerProperty: Key: MarginAXYTBLR, DisplayName: Margins, FieldType: String, DefaultValue: a=?; x=?; y=?; t=?; b=?; l=?; r=? , Description: Margins A(all)-X(LR)-Y(TB)-T-B-L-R
#DesignerProperty: Key: PaddingAXYTBLR, DisplayName: Paddings, FieldType: String, DefaultValue: a=4; x=?; y=?; t=?; b=?; l=?; r=? , Description: Paddings A(all)-X(LR)-Y(TB)-T-B-L-R
#DesignerProperty: Key: RawClasses, DisplayName: Classes (;), FieldType: String, DefaultValue: , Description: Classes added to the HTML tag.
#DesignerProperty: Key: RawStyles, DisplayName: Styles (JSON), FieldType: String, DefaultValue: , Description: Styles added to the HTML tag. Must be a json String use = and ;
#DesignerProperty: Key: RawAttributes, DisplayName: Attributes (JSON), FieldType: String, DefaultValue: , Description: Attributes added to the HTML tag. Must be a json String use = and ;

'global variables in this module
Sub Class_Globals
	Public UI As UIShared 'ignore
	Public CustProps As Map 'ignore
	Private mCallBack As Object 'ignore
	Private mEventName As String 'ignore
	Private mElement As BANanoElement 'ignore
	Private mTarget As BANanoElement 'ignore
	Private mName As String 'ignore
	Private BANano As BANano   'ignore
	Private sPosition As String = "t=?; b=?; r=?; l=?"
	Private sPositionStyle As String = "none"
	Private sRawClasses As String = ""
	Private sRawStyles As String = ""
	Private sRawAttributes As String = ""
	Private sMarginAXYTBLR As String = "a=?; x=?; y=?; t=?; b=?; l=?; r=?"
	Private sPaddingAXYTBLR As String = "a=4; x=?; y=?; t=?; b=?; l=?; r=?"
	Private sParentID As String = ""
	Private bVisible As Boolean = True'ignore
	Private bEnabled As Boolean = True'ignore
	Private sTypeOf As String = "bar"
	Private sHeight As String = "350px"
	Private sWidth As String = "100%"
	Private sTheme As String = ""
	Private bShowLegend As Boolean = True
	Private sLegendPosition As String = "bottom"
	Private bShowToolbar As Boolean = True
	Private sTitle As String = ""
	Private bShowDataLabels As Boolean = False
	Private sDataLabelOrientation As String = "horizontal"
	Private sDataLabelPosition As String = "center"
	Private sXAxisTitle As String = ""
	Private sYAxisTitle As String = ""
	Private sCurve As String = "smooth"
	Private iLineWidth As Int = 2
	Private sCategories As String = ""
	Private bDonutShowTotal As Boolean = True
	Private sHollowSize As String = "50%"
	Private bDashedRadial As Boolean = False
	Private sTrackWidth As String = "97%"
	Private iXAxisOffsetY As Int = 2
	Private iXAxisLabelRotate As Int = 0
	Private iXAxisLabelRotateOffsetY As Int = 25
	Private bGradient As Boolean = True
	Private bRealtime As Boolean = False
	Private iMarkerSize As Int = 6
	Private bStacked As Boolean = False
	Private iBorderRadius As Int = 4
	Private sXAxisOutputFormat As String = "normal"
	Private sYAxisOutputFormat As String = "normal"
	Private sColumnWidth As String = "70%"
	Private iStartAngle As Int = 0
	Private iEndAngle As Int = 360
	Private bBarLabels As Boolean = False
	Private bSparkline As Boolean = False
	Private bGridShow As Boolean = True
	Private bTooltipEnabled As Boolean = True
	Private sSubtitle As String = ""
	Private sSubtitleFontSize As String = "12px"
	Private sTitleFontSize As String = "14px"
	Private sData As String = ""
	Private sOptions As String = ""
	Private sSeries As String = ""
	Private sColors As String = ""
	Private bLegendVisible As Boolean = True
	Public Tag As Object
	Private sRounded As String = "lg"
	Private bRoundedBox As Boolean = False
	Private sShadow As String = "lg"
End Sub

'initialize the custom view class
Public Sub Initialize (Callback As Object, Name As String, EventName As String)
	If BANano.AssetsIsDefined("Apex") = False Then
		BANano.Throw($"Uses Error: 'BANano.Await(app.UsesApex)' should be added for '${Name}'"$)
		Return
	End If
	UI.Initialize(Me)
	mElement = Null
	mEventName = UI.CleanID(EventName)
	mName = UI.CleanID(Name)
	mCallBack = Callback
	CustProps.Initialize
	BANano.DependsOnAsset("SithasoApexChart.min.js")
	SetDefaults
End Sub
'
Private Sub SetDefaults
	CustProps.Put("ParentID", "")
	CustProps.Put("TypeOf", "bar")
	CustProps.Put("Title", "")
	CustProps.Put("TitleFontSize", "14px")
	CustProps.Put("Subtitle", "")
	CustProps.Put("SubtitleFontSize", "12px")
	CustProps.Put("Width", "100%")
	CustProps.Put("Height", "350px")
	CustProps.Put("BarLabels", False)
	CustProps.Put("BorderRadius", 4)
	CustProps.Put("ColumnWidth", "70%")
	CustProps.Put("Curve", "smooth")
	CustProps.Put("DashedRadial", False)
	CustProps.Put("DataLabelOrientation", "horizontal")
	CustProps.Put("DataLabelPosition", "center")
	CustProps.Put("DonutShowTotal", True)
	CustProps.Put("EndAngle", 360)
	CustProps.Put("Gradient", True)
	CustProps.Put("GridShow", True)
	CustProps.Put("HollowSize", "50%")
	CustProps.Put("LegendPosition", "bottom")
	CustProps.Put("LegendVisible", True)
	CustProps.Put("LineWidth", 2)
	CustProps.Put("MarkerSize", 6)
	CustProps.Put("Realtime", False)
	CustProps.Put("ShowDataLabels", False)
	CustProps.Put("ShowLegend", True)
	CustProps.Put("ShowToolbar", True)
	CustProps.Put("Sparkline", False)
	CustProps.Put("Stacked", False)
	CustProps.Put("StartAngle", 0)
	CustProps.Put("Theme", "")
	CustProps.Put("TooltipEnabled", True)
	CustProps.Put("TrackWidth", "97%")
	CustProps.Put("XAxisTitle", "")
	CustProps.Put("XAxisLabelRotate", 0)
	CustProps.Put("XAxisLabelRotateOffsetY", 25)
	CustProps.Put("XAxisOffsetY", 2)
	CustProps.Put("XAxisOutputFormat", "normal")
	CustProps.Put("YAxisTitle", "")
	CustProps.Put("YAxisOutputFormat", "normal")
	CustProps.Put("Visible", True)
	CustProps.Put("Enabled", True)
	CustProps.Put("PositionStyle", "none")
	CustProps.Put("Position", "t=?; b=?; r=?; l=?")
	CustProps.Put("MarginAXYTBLR", "a=?; x=?; y=?; t=?; b=?; l=?; r=?")
	CustProps.Put("PaddingAXYTBLR", "a=4; x=?; y=?; t=?; b=?; l=?; r=?")
	CustProps.Put("RawClasses", "")
	CustProps.Put("RawStyles", "")
	CustProps.Put("RawAttributes", "")
	CustProps.Put("Rounded", "lg")
	CustProps.Put("RoundedBox", False)
	CustProps.Put("Shadow", "lg")
End Sub

Sub OnEvent(event As String, MethodName As String)
	UI.OnEvent(mElement, event, mCallBack, MethodName)
End Sub

' returns the element id
Public Sub getID() As String
	Return mName
End Sub

'set properties from an outside source
Sub SetProperties(props As Map)
	CustProps = BANano.DeepClone(props)
	sParentID = CustProps.Get("ParentID")
End Sub

Sub GetProperties As Map
	Return CustProps
End Sub

'add this element to an existing parent element using current properties
Public Sub AddComponent
	If sParentID = "" Then Return
	mTarget = BANano.GetElement("#" & sParentID)
	DesignerCreateView(mTarget, CustProps)
End Sub

'remove this element from the dom
Public Sub Remove()
	mElement.Remove
	BANano.SetMeToNull
End Sub
'set the parent id
Sub setParentID(s As String)
	s = UI.CleanID(s)
	sParentID = s
	CustProps.Put("ParentID", sParentID)
End Sub
'get the parent id
Sub getParentID As String
	Return sParentID
End Sub
'return the #ID of the element
Public Sub getHere() As String
	Return $"#${mName}"$
End Sub

'code to design the view
Public Sub DesignerCreateView (Target As BANanoElement, Props As Map)
	mTarget = Target
	If Props <> Null Then
		CustProps = Props
		UI.SetProps(Props)
		UI.ExcludeTextColor = True
		UI.ExcludeBackgroundColor = True
		sParentID = Props.GetDefault("ParentID", "")
		sParentID = UI.CStr(sParentID)
		sTypeOf = Props.GetDefault("TypeOf", "bar")
		sTypeOf = UI.CStr(sTypeOf)
		sHeight = Props.GetDefault("Height", "350px")
		sHeight = UI.CStr(sHeight)
		sWidth = Props.GetDefault("Width", "100%")
		sWidth = UI.CStr(sWidth)
		sTheme = Props.GetDefault("Theme", "")
		sTheme = UI.CStr(sTheme)
		bShowLegend = Props.GetDefault("ShowLegend", True)
		bShowLegend = UI.CBool(bShowLegend)
		sLegendPosition = Props.GetDefault("LegendPosition", "bottom")
		sLegendPosition = UI.CStr(sLegendPosition)
		bShowToolbar = Props.GetDefault("ShowToolbar", True)
		bShowToolbar = UI.CBool(bShowToolbar)
		sTitle = Props.GetDefault("Title", "")
		sTitle = UI.CStr(sTitle)
		bShowDataLabels = Props.GetDefault("ShowDataLabels", False)
		bShowDataLabels = UI.CBool(bShowDataLabels)
		sDataLabelOrientation = Props.GetDefault("DataLabelOrientation", "horizontal")
		sDataLabelOrientation = UI.CStr(sDataLabelOrientation)
		sDataLabelPosition = Props.GetDefault("DataLabelPosition", "center")
		sDataLabelPosition = UI.CStr(sDataLabelPosition)
		sXAxisTitle = Props.GetDefault("XAxisTitle", "")
		sXAxisTitle = UI.CStr(sXAxisTitle)
		sYAxisTitle = Props.GetDefault("YAxisTitle", "")
		sYAxisTitle = UI.CStr(sYAxisTitle)
		sCurve = Props.GetDefault("Curve", "smooth")
		sCurve = UI.CStr(sCurve)
		iLineWidth = Props.GetDefault("LineWidth", 2)
		iLineWidth = UI.CInt(iLineWidth)
		bDonutShowTotal = Props.GetDefault("DonutShowTotal", True)
		bDonutShowTotal = UI.CBool(bDonutShowTotal)
		sHollowSize = Props.GetDefault("HollowSize", "50%")
		sHollowSize = UI.CStr(sHollowSize)
		bDashedRadial = Props.GetDefault("DashedRadial", False)
		bDashedRadial = UI.CBool(bDashedRadial)
		sTrackWidth = Props.GetDefault("TrackWidth", "97%")
		sTrackWidth = UI.CStr(sTrackWidth)
		iXAxisOffsetY = Props.GetDefault("XAxisOffsetY", 2)
		iXAxisOffsetY = UI.CInt(iXAxisOffsetY)
		iXAxisLabelRotate = Props.GetDefault("XAxisLabelRotate", 0)
		iXAxisLabelRotate = UI.CInt(iXAxisLabelRotate)
		iXAxisLabelRotateOffsetY = Props.GetDefault("XAxisLabelRotateOffsetY", 25)
		iXAxisLabelRotateOffsetY = UI.CInt(iXAxisLabelRotateOffsetY)
		bGradient = Props.GetDefault("Gradient", True)
		bGradient = UI.CBool(bGradient)
		bRealtime = Props.GetDefault("Realtime", False)
		bRealtime = UI.CBool(bRealtime)
		iMarkerSize = Props.GetDefault("MarkerSize", 6)
		iMarkerSize = UI.CInt(iMarkerSize)
		bStacked = Props.GetDefault("Stacked", False)
		bStacked = UI.CBool(bStacked)
		iBorderRadius = Props.GetDefault("BorderRadius", 4)
		iBorderRadius = UI.CInt(iBorderRadius)
		sXAxisOutputFormat = Props.GetDefault("XAxisOutputFormat", "normal")
		sXAxisOutputFormat = UI.CStr(sXAxisOutputFormat)
		sYAxisOutputFormat = Props.GetDefault("YAxisOutputFormat", "normal")
		sYAxisOutputFormat = UI.CStr(sYAxisOutputFormat)
		sColumnWidth = Props.GetDefault("ColumnWidth", "70%")
		sColumnWidth = UI.CStr(sColumnWidth)
		iStartAngle = Props.GetDefault("StartAngle", 0)
		iStartAngle = UI.CInt(iStartAngle)
		iEndAngle = Props.GetDefault("EndAngle", 360)
		iEndAngle = UI.CInt(iEndAngle)
		bBarLabels = Props.GetDefault("BarLabels", False)
		bBarLabels = UI.CBool(bBarLabels)
		bSparkline = Props.GetDefault("Sparkline", False)
		bSparkline = UI.CBool(bSparkline)
		bGridShow = Props.GetDefault("GridShow", True)
		bGridShow = UI.CBool(bGridShow)
		bTooltipEnabled = Props.GetDefault("TooltipEnabled", True)
		bTooltipEnabled = UI.CBool(bTooltipEnabled)
		sSubtitle = Props.GetDefault("Subtitle", "")
		sSubtitle = UI.CStr(sSubtitle)
		sSubtitleFontSize = Props.GetDefault("SubtitleFontSize", "12px")
		sSubtitleFontSize = UI.CStr(sSubtitleFontSize)
		sTitleFontSize = Props.GetDefault("TitleFontSize", "14px")
		sTitleFontSize = UI.CStr(sTitleFontSize)
		bLegendVisible = Props.GetDefault("LegendVisible", True)
		bLegendVisible = UI.CBool(bLegendVisible)
		bVisible = Props.GetDefault("Visible", True)
		bVisible = UI.CBool(bVisible)
		bEnabled = Props.GetDefault("Enabled", True)
		bEnabled = UI.CBool(bEnabled)
		sPositionStyle = Props.GetDefault("PositionStyle", "none")
		sPositionStyle = UI.CStr(sPositionStyle)
		If sPositionStyle = "none" Then sPositionStyle = ""
		sPosition = Props.GetDefault("Position", "t=?; b=?; r=?; l=?")
		sPosition = UI.CStr(sPosition)
		sMarginAXYTBLR = Props.GetDefault("MarginAXYTBLR", "a=?; x=?; y=?; t=?; b=?; l=?; r=?")
		sMarginAXYTBLR = UI.CStr(sMarginAXYTBLR)
		sPaddingAXYTBLR = Props.GetDefault("PaddingAXYTBLR", "a=4; x=?; y=?; t=?; b=?; l=?; r=?")
		sPaddingAXYTBLR = UI.CStr(sPaddingAXYTBLR)
		sRawClasses = Props.GetDefault("RawClasses", "")
		sRawClasses = UI.CStr(sRawClasses)
		sRawStyles = Props.GetDefault("RawStyles", "")
		sRawStyles = UI.CStr(sRawStyles)
		sRawAttributes = Props.GetDefault("RawAttributes", "")
		sRawAttributes = UI.CStr(sRawAttributes)
		sRounded = Props.GetDefault("Rounded", "lg")
		sRounded = UI.CStr(sRounded)
		If sRounded = "none" Then sRounded = ""
		bRoundedBox = Props.GetDefault("RoundedBox", False)
		bRoundedBox = UI.CBool(bRoundedBox)
		sShadow = Props.GetDefault("Shadow", "lg")
		sShadow = UI.CStr(sShadow)
		If sShadow = "none" Then sShadow = ""
	End If
	
	UI.AddAttrDT("type", sTypeOf)
	UI.AddAttrDT("height", sHeight)
	UI.AddAttrDT("width", sWidth)
	UI.AddAttrDT("theme", sTheme)
	UI.AddAttrDT("show-legend", bShowLegend)
	UI.AddAttrDT("legend-position", sLegendPosition)
	UI.AddAttrDT("show-toolbar", bShowToolbar)
	UI.AddAttrDT("title", sTitle)
	UI.AddAttrDT("show-data-labels", bShowDataLabels)
	UI.AddAttrDT("data-label-orientation", sDataLabelOrientation)
	UI.AddAttrDT("data-label-position", sDataLabelPosition)
	UI.AddAttrDT("x-axis-title", sXAxisTitle)
	UI.AddAttrDT("y-axis-title", sYAxisTitle)
	UI.AddAttrDT("curve", sCurve)
	UI.AddAttrDT("line-width", iLineWidth)
	UI.AddAttrDT("donut-show-total", bDonutShowTotal)
	UI.AddAttrDT("hollow-size", sHollowSize)
	UI.AddAttrDT("dashed-radial", bDashedRadial)
	UI.AddAttrDT("track-width", sTrackWidth)
	UI.AddAttrDT("x-axis-offsety", iXAxisOffsetY)
	UI.AddAttrDT("x-axis-label-rotate", iXAxisLabelRotate)
	UI.AddAttrDT("x-axis-label-rotate-offsety", iXAxisLabelRotateOffsetY)
	UI.AddAttrDT("gradient", bGradient)
	UI.AddAttrDT("realtime", bRealtime)
	UI.AddAttrDT("marker-size", iMarkerSize)
	UI.AddAttrDT("stacked", bStacked)
	UI.AddAttrDT("border-radius", iBorderRadius)
	UI.AddAttrDT("x-axis-output-format", sXAxisOutputFormat)
	UI.AddAttrDT("y-axis-output-format", sYAxisOutputFormat)
	UI.AddAttrDT("column-width", sColumnWidth)
	UI.AddAttrDT("start-angle", iStartAngle)
	UI.AddAttrDT("end-angle", iEndAngle)
	UI.AddAttrDT("bar-labels", bBarLabels)
	UI.AddAttrDT("sparkline", bSparkline)
	UI.AddAttrDT("grid-show", bGridShow)
	UI.AddAttrDT("tooltip-enabled", bTooltipEnabled)
	UI.AddAttrDT("subtitle", sSubtitle)
	UI.AddAttrDT("subtitle-font-size", sSubtitleFontSize)
	UI.AddAttrDT("title-font-size", sTitleFontSize)
	UI.AddAttrDT("show-legend", bLegendVisible)
	If sRounded <> "" Then UI.AddRoundedDT(sRounded)
	If bRoundedBox = True Then UI.AddClassDT("rounded-box")
	If sShadow <> "" Then UI.AddShadowDT(sShadow)
	
	'
	Dim xattrs As String = UI.BuildExAttributes
	Dim xstyles As String = UI.BuildExStyle
	Dim xclasses As String = UI.BuildExClass
	'
	If sParentID <> "" Then
		'does the parent exist
		If BANano.Exists($"#${sParentID}"$) = False Then
			BANano.Throw($"${mName}.DesignerCreateView: '${sParentID}' parent does not exist!"$)
			Return
		End If
		mTarget.Initialize($"#${sParentID}"$)
	End If

	mElement = mTarget.Append($"[BANCLEAN]<sithaso-apex id="${mName}" class="${xclasses}" ${xattrs} style="${xstyles}"></sithaso-apex>"$).Get("#" & mName)
End Sub

'set Visible
Sub setVisible(b As Boolean)
	bVisible = b
	CustProps.Put("Visible", b)
	If mElement = Null Then Return
	UI.SetVisible(mElement, b)
End Sub
'get Visible
Sub getVisible As Boolean
	Return UI.GetVisible(mElement)
End Sub
'set Enabled
Sub setEnabled(b As Boolean)
	bEnabled = b
	CustProps.Put("Enabled", b)
	If mElement = Null Then Return
	UI.SetEnabled(mElement, b)
End Sub
'get Enabled
Sub getEnabled As Boolean
	Return UI.GetEnabled(mElement)
End Sub
'set Position Style
'options: static|relative|fixed|absolute|sticky|none
Sub setPositionStyle(s As String)
	sPositionStyle = s
	CustProps.put("PositionStyle", s)
	If mElement = Null Then Return
	If s <> "" Then UI.SetStyle(mElement, "position", s)
End Sub
Sub getPositionStyle As String
	Return sPositionStyle
End Sub
'set raw positions
Sub setPosition(s As String)
	sPosition = s
	CustProps.Put("Position", sPosition)
	If mElement = Null Then Return
	If s <> "" Then UI.SetPosition(mElement, sPosition)
End Sub
Sub getPosition As String
	Return sPosition
End Sub
Sub setAttributes(s As String)
	sRawAttributes = s
	CustProps.Put("RawAttributes", s)
	If mElement = Null Then Return
	If s <> "" Then UI.SetAttributes(mElement, sRawAttributes)
End Sub
'
Sub setStyles(s As String)
	sRawStyles = s
	CustProps.Put("RawStyles", s)
	If mElement = Null Then Return
	If s <> "" Then UI.SetStyles(mElement, sRawStyles)
End Sub
'
Sub setClasses(s As String)
	sRawClasses = s
	CustProps.put("RawClasses", s)
	If mElement = Null Then Return
	If s <> "" Then UI.SetClasses(mElement, sRawClasses)
End Sub
'
Sub setPaddingAXYTBLR(s As String)
	sPaddingAXYTBLR = s
	CustProps.Put("PaddingAXYTBLR", s)
	If mElement = Null Then Return
	If s <> "" Then UI.SetPaddingAXYTBLR(mElement, sPaddingAXYTBLR)
End Sub
'
Sub setMarginAXYTBLR(s As String)
	sMarginAXYTBLR = s
	CustProps.Put("MarginAXYTBLR", s)
	If mElement = Null Then Return
	If s <> "" Then UI.SetMarginAXYTBLR(mElement, sMarginAXYTBLR)
End Sub
'
Sub AddClass(className As String)
	If mElement = Null Then Return
	UI.AddClass(mElement, className)
End Sub

'get Shadow
Sub getShadow As String
	Return sShadow
End Sub

'get Rounded
Sub getRounded As String
	Return sRounded
End Sub
'get Rounded Box
Sub getRoundedBox As Boolean
	Return bRoundedBox
End Sub

'set Shadow
'options: shadow|sm|md|lg|xl|2xl|inner|none
Sub setShadow(s As String)
	sShadow = s
	CustProps.put("Shadow", s)
	If mElement = Null Then Return
	If s <> "" Then UI.SetShadow(mElement, sShadow)
End Sub

'set Rounded
'options: none|rounded|2xl|3xl|full|lg|md|sm|xl|0
Sub setRounded(s As String)
	sRounded = s
	CustProps.put("Rounded", s)
	If mElement = Null Then Return
	If s <> "" Then UI.SetRounded(mElement, sRounded)
End Sub
'set Rounded Box
Sub setRoundedBox(b As Boolean)
	bRoundedBox = b
	CustProps.put("RoundedBox", b)
	If mElement = Null Then Return
	If b = True Then
		UI.AddClass(mElement, "rounded-box")
	Else
		UI.RemoveClass(mElement, "rounded-box")
	End If
End Sub

Sub getAttributes As String
	Return sRawAttributes
End Sub
'
Sub getStyles As String
	Return sRawStyles
End Sub
'
Sub getClasses As String
	Return sRawClasses
End Sub
'
Sub getPaddingAXYTBLR As String
	Return sPaddingAXYTBLR
End Sub
'
Sub getMarginAXYTBLR As String
	Return sMarginAXYTBLR
End Sub

'set Type
Sub setTypeOf(s As String)
	sTypeOf = s
	CustProps.Put("TypeOf", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "type", s)
End Sub
'get Type
Sub getTypeOf As String
	Return sTypeOf
End Sub

'set Height
Sub setHeight(s As String)
	sHeight = s
	CustProps.Put("Height", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "height", s)
End Sub
'get Height
Sub getHeight As String
	Return sHeight
End Sub
'set Width
Sub setWidth(s As String)
	sWidth = s
	CustProps.Put("Width", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "width", s)
End Sub
'get Width
Sub getWidth As String
	Return sWidth
End Sub
'set Theme
Sub setTheme(s As String)
	sTheme = s
	CustProps.Put("Theme", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "theme", s)
End Sub
'get Theme
Sub getTheme As String
	Return sTheme
End Sub
'set ShowLegend
Sub setShowLegend(b As Boolean)
	bShowLegend = b
	CustProps.Put("ShowLegend", b)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "show-legend", b)
End Sub
'get ShowLegend
Sub getShowLegend As Boolean
	Return bShowLegend
End Sub
'set LegendPosition
Sub setLegendPosition(s As String)
	sLegendPosition = s
	CustProps.Put("LegendPosition", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "legend-position", s)
End Sub
'get LegendPosition
Sub getLegendPosition As String
	Return sLegendPosition
End Sub
'set ShowToolbar
Sub setShowToolbar(b As Boolean)
	bShowToolbar = b
	CustProps.Put("ShowToolbar", b)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "show-toolbar", b)
End Sub
'get ShowToolbar
Sub getShowToolbar As Boolean
	Return bShowToolbar
End Sub
'set Title
Sub setTitle(s As String)
	sTitle = s
	CustProps.Put("Title", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "title", s)
End Sub
'get Title
Sub getTitle As String
	Return sTitle
End Sub
'set ShowDataLabels
Sub setShowDataLabels(b As Boolean)
	bShowDataLabels = b
	CustProps.Put("ShowDataLabels", b)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "show-data-labels", b)
End Sub
'get ShowDataLabels
Sub getShowDataLabels As Boolean
	Return bShowDataLabels
End Sub
'set DataLabelOrientation
Sub setDataLabelOrientation(s As String)
	sDataLabelOrientation = s
	CustProps.Put("DataLabelOrientation", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "data-label-orientation", s)
End Sub
'get DataLabelOrientation
Sub getDataLabelOrientation As String
	Return sDataLabelOrientation
End Sub
'set DataLabelPosition
Sub setDataLabelPosition(s As String)
	sDataLabelPosition = s
	CustProps.Put("DataLabelPosition", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "data-label-position", s)
End Sub
'get DataLabelPosition
Sub getDataLabelPosition As String
	Return sDataLabelPosition
End Sub
'set XAxisTitle
Sub setXAxisTitle(s As String)
	sXAxisTitle = s
	CustProps.Put("XAxisTitle", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "x-axis-title", s)
End Sub
'get XAxisTitle
Sub getXAxisTitle As String
	Return sXAxisTitle
End Sub
'set YAxisTitle
Sub setYAxisTitle(s As String)
	sYAxisTitle = s
	CustProps.Put("YAxisTitle", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "y-axis-title", s)
End Sub
'get YAxisTitle
Sub getYAxisTitle As String
	Return sYAxisTitle
End Sub
'set Curve
Sub setCurve(s As String)
	sCurve = s
	CustProps.Put("Curve", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "curve", s)
End Sub
'get Curve
Sub getCurve As String
	Return sCurve
End Sub
'set LineWidth
Sub setLineWidth(i As Int)
	iLineWidth = i
	CustProps.Put("LineWidth", i)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "line-width", i)
End Sub
'get LineWidth
Sub getLineWidth As Int
	Return iLineWidth
End Sub
'set DonutShowTotal
Sub setDonutShowTotal(b As Boolean)
	bDonutShowTotal = b
	CustProps.Put("DonutShowTotal", b)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "donut-show-total", b)
End Sub
'get DonutShowTotal
Sub getDonutShowTotal As Boolean
	Return bDonutShowTotal
End Sub
'set HollowSize
Sub setHollowSize(s As String)
	sHollowSize = s
	CustProps.Put("HollowSize", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "hollow-size", s)
End Sub
'get HollowSize
Sub getHollowSize As String
	Return sHollowSize
End Sub
'set DashedRadial
Sub setDashedRadial(b As Boolean)
	bDashedRadial = b
	CustProps.Put("DashedRadial", b)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "dashed-radial", b)
End Sub
'get DashedRadial
Sub getDashedRadial As Boolean
	Return bDashedRadial
End Sub
'set TrackWidth
Sub setTrackWidth(s As String)
	sTrackWidth = s
	CustProps.Put("TrackWidth", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "track-width", s)
End Sub
'get TrackWidth
Sub getTrackWidth As String
	Return sTrackWidth
End Sub
'set XAxisOffsetY
Sub setXAxisOffsetY(i As Int)
	iXAxisOffsetY = i
	CustProps.Put("XAxisOffsetY", i)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "x-axis-offsety", i)
End Sub
'get XAxisOffsetY
Sub getXAxisOffsetY As Int
	Return iXAxisOffsetY
End Sub
'set XAxisLabelRotate
Sub setXAxisLabelRotate(i As Int)
	iXAxisLabelRotate = i
	CustProps.Put("XAxisLabelRotate", i)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "x-axis-label-rotate", i)
End Sub
'get XAxisLabelRotate
Sub getXAxisLabelRotate As Int
	Return iXAxisLabelRotate
End Sub
'set XAxisLabelRotateOffsetY
Sub setXAxisLabelRotateOffsetY(i As Int)
	iXAxisLabelRotateOffsetY = i
	CustProps.Put("XAxisLabelRotateOffsetY", i)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "x-axis-label-rotate-offsety", i)
End Sub
'get XAxisLabelRotateOffsetY
Sub getXAxisLabelRotateOffsetY As Int
	Return iXAxisLabelRotateOffsetY
End Sub
'set Gradient
Sub setGradient(b As Boolean)
	bGradient = b
	CustProps.Put("Gradient", b)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "gradient", b)
End Sub
'get Gradient
Sub getGradient As Boolean
	Return bGradient
End Sub
'set Realtime
Sub setRealtime(b As Boolean)
	bRealtime = b
	CustProps.Put("Realtime", b)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "realtime", b)
End Sub
'get Realtime
Sub getRealtime As Boolean
	Return bRealtime
End Sub
'set MarkerSize
Sub setMarkerSize(i As Int)
	iMarkerSize = i
	CustProps.Put("MarkerSize", i)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "marker-size", i)
End Sub
'get MarkerSize
Sub getMarkerSize As Int
	Return iMarkerSize
End Sub
'set Stacked
Sub setStacked(b As Boolean)
	bStacked = b
	CustProps.Put("Stacked", b)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "stacked", b)
End Sub
'get Stacked
Sub getStacked As Boolean
	Return bStacked
End Sub
'set BorderRadius
Sub setBorderRadius(i As Int)
	iBorderRadius = i
	CustProps.Put("BorderRadius", i)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "border-radius", i)
End Sub
'get BorderRadius
Sub getBorderRadius As Int
	Return iBorderRadius
End Sub
'set XAxisOutputFormat
Sub setXAxisOutputFormat(s As String)
	sXAxisOutputFormat = s
	CustProps.Put("XAxisOutputFormat", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "x-axis-output-format", s)
End Sub
'get XAxisOutputFormat
Sub getXAxisOutputFormat As String
	Return sXAxisOutputFormat
End Sub
'set YAxisOutputFormat
Sub setYAxisOutputFormat(s As String)
	sYAxisOutputFormat = s
	CustProps.Put("YAxisOutputFormat", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "y-axis-output-format", s)
End Sub
'get YAxisOutputFormat
Sub getYAxisOutputFormat As String
	Return sYAxisOutputFormat
End Sub
'set ColumnWidth
Sub setColumnWidth(s As String)
	sColumnWidth = s
	CustProps.Put("ColumnWidth", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "column-width", s)
End Sub
'get ColumnWidth
Sub getColumnWidth As String
	Return sColumnWidth
End Sub
'set Categories
Sub setCategories(s As String)
	sCategories = s
	CustProps.Put("Categories", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "categories", s)
End Sub
'get Categories
Sub getCategories As String
	Return sCategories
End Sub
'set StartAngle
Sub setStartAngle(i As Int)
	iStartAngle = i
	CustProps.Put("StartAngle", i)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "start-angle", i)
End Sub
'get StartAngle
Sub getStartAngle As Int
	Return iStartAngle
End Sub
'set EndAngle
Sub setEndAngle(i As Int)
	iEndAngle = i
	CustProps.Put("EndAngle", i)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "end-angle", i)
End Sub
'get EndAngle
Sub getEndAngle As Int
	Return iEndAngle
End Sub
'set BarLabels
Sub setBarLabels(b As Boolean)
	bBarLabels = b
	CustProps.Put("BarLabels", b)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "bar-labels", b)
End Sub
'get BarLabels
Sub getBarLabels As Boolean
	Return bBarLabels
End Sub
'set Sparkline
Sub setSparkline(b As Boolean)
	bSparkline = b
	CustProps.Put("Sparkline", b)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "sparkline", b)
End Sub
'get Sparkline
Sub getSparkline As Boolean
	Return bSparkline
End Sub
'set GridShow
Sub setGridShow(b As Boolean)
	bGridShow = b
	CustProps.Put("GridShow", b)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "grid-show", b)
End Sub
'get GridShow
Sub getGridShow As Boolean
	Return bGridShow
End Sub
'set TooltipEnabled
Sub setTooltipEnabled(b As Boolean)
	bTooltipEnabled = b
	CustProps.Put("TooltipEnabled", b)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "tooltip-enabled", b)
End Sub
'get TooltipEnabled
Sub getTooltipEnabled As Boolean
	Return bTooltipEnabled
End Sub
'set Subtitle
Sub setSubtitle(s As String)
	sSubtitle = s
	CustProps.Put("Subtitle", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "subtitle", s)
End Sub
'get Subtitle
Sub getSubtitle As String
	Return sSubtitle
End Sub
'set SubtitleFontSize
Sub setSubtitleFontSize(s As String)
	sSubtitleFontSize = s
	CustProps.Put("SubtitleFontSize", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "subtitle-font-size", s)
End Sub
'get SubtitleFontSize
Sub getSubtitleFontSize As String
	Return sSubtitleFontSize
End Sub
'set TitleFontSize
Sub setTitleFontSize(s As String)
	sTitleFontSize = s
	CustProps.Put("TitleFontSize", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "title-font-size", s)
End Sub
'get TitleFontSize
Sub getTitleFontSize As String
	Return sTitleFontSize
End Sub
'set Data
Sub setData(s As String)
	sData = s
	CustProps.Put("Data", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "data", s)
End Sub
'get Data
Sub getData As String
	Return sData
End Sub
'set Options
Sub setOptions(s As String)
	sOptions = s
	CustProps.Put("Options", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "options", s)
End Sub
'get Options
Sub getOptions As String
	Return sOptions
End Sub
'set Series
Sub setSeries(s As String)
	sSeries = s
	CustProps.Put("Series", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "data", s)
End Sub
'get Series
Sub getSeries As String
	Return sSeries
End Sub
'set Colors
Sub setColors(s As String)
	sColors = s
	CustProps.Put("Colors", s)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "colors", s)
End Sub
'get Colors
Sub getColors As String
	Return sColors
End Sub
'set LegendVisible
Sub setLegendVisible(b As Boolean)
	bLegendVisible = b
	CustProps.Put("LegendVisible", b)
	If mElement = Null Then Return
	UI.SetAttr(mElement, "show-legend", b)
End Sub
'get LegendVisible
Sub getLegendVisible As Boolean
	Return bLegendVisible
End Sub

'API methods for chart control
Public Sub Clear
	If mElement = Null Then Return
	mElement.RunMethod("clear", Null)
End Sub

Public Sub Refresh
	If mElement = Null Then Return
	mElement.RunMethod("refresh", Null)
End Sub

'<code>
'thisComp.AddCategories(Array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"))
'</code>
Sub AddCategories(cats As List)
	If mElement = Null Then Return
	mElement.RunMethod("addCategories", Array(cats))
End Sub

'<code>
'thisComp.AddSeries("Daily Visitors", "#008FFB", Array(1200, 1350, 1180, 1420, 1680, 1890, 2100))
'</code>
Sub AddSeries(serName As String, serColor As String, serValues As Object)
	If mElement = Null Then Return
	mElement.RunMethod("addSeries", Array(serName, serColor, serValues))
End Sub

'<code>
'thisComp.addSeriesColor("Data Points", "#008FFB")
'</code>
Sub AddSeriesColor(serName As String, serColor As String)
	If mElement = Null Then Return
	mElement.RunMethod("addSeriesColor", Array(serName, serColor))
End Sub

'<code>
'thisComp.addSeriesPoint(xSeries, "Jan", Array(-2, 4))
'thisComp.addSeriesPoint("Data Points", 10, 20)
'</code>
Sub AddSeriesPoint(serName As String, x As String, y As Object)
	If mElement = Null Then Return
	mElement.RunMethod("addSeriesPoint", Array(serName, x, y))
End Sub	

'update the series
Public Sub UpdateSeries(mSeries As Map)
	If mElement = Null Then Return
	mElement.RunMethod("updateSeries", Array(mSeries))
End Sub

'update options at runtime
Public Sub UpdateOptions(mOptions As Map)
	If mElement = Null Then Return
	mElement.runmethod("updateOptions", Array(mOptions))
End Sub
