Type=Class Version=4.7 ModulesStructureVersion=1 B4J=true @EndOfDesignText@ Sub Class_Globals Dim ABM As ABMaterial 'ignore Dim ABMComp As ABMCustomComponent Private mTitle As String Private mWidth As String = "100%" Private mHeight As String = "500px" Private Series As List Private SeriesColors As List Private SeriesOptions As List Private mChartType As String Private DataRows As List Public barGroupMargin As Int = 4 Public TopMargin As Int = 30 Public BottomMargin As Int = 10 Public RightMargin As Int = 10 Public LeftMargin As Int = 30 Public drawGridlines As Boolean = True Public SingleSeries As Boolean = False Public InitString As String Type highLighterObject(show As Boolean, sizeAdjust As Double, showMarker As Boolean, tooltipAxes As String, yvalues As Int, formatString As String) Type cursorObject(show As Boolean,tooltipLocation As String) Type linePatternObject(dashed As String, dotted As String) Type markerStyleObject(diamond As String,circle As String, x As String) Type markerOptionsObject(style As String, size As Int, show As Boolean) Type tickOptionsObject(formatString As String) Type animationObject(show As Boolean) Type rendererOptionsObject(smooth As Boolean,varyBarColor As Boolean, animation As animationObject) Type ChartTypesObject(bar As String, line As String, pie As String) Type AxisObject(yMin As Object,yMax As Object, Renderer As String, label As String, pad As String, numberTicks As Int, ticks As List, tickOptions As tickOptionsObject) Type seriesDefaultsObject(showMarker As Boolean, Renderer As String, markerOptions As markerOptionsObject, rendererOptions As rendererOptionsObject) Type SeriesObject(seriesName As String, seriesColor As String, linePattern As String, lineWidth As Int, markerOptions As markerOptionsObject, showLine As Boolean) Type axesDefaultsObject(xyMin As Object,xyMax As Object, yAxis As AxisObject, xAxis As AxisObject, labelRenderer As String) Type RendererObject(LogAxisRenderer As String, CanvasAxisLabelRenderer As String, BarRenderer As String,CategoryAxisRenderer As String, DateAxisRenderer As String) Public axesDefaults As axesDefaultsObject Public seriesDefaults As seriesDefaultsObject Public Renderer As RendererObject Public ChartType As ChartTypesObject Public linePattern As linePatternObject Public markerStyle As markerStyleObject Public highLight As highLighterObject Public cursor As cursorObject End Sub 'Initializes the object. You can add parameters to this method if needed. Public Sub Initialize(InternalPage As ABMPage, ID As String) ABMComp.Initialize("ABMComp", Me, InternalPage, ID) 'ABMComp.Visibility = ABM.VISIBILITY_HIDE_ALL ' hide the chart while loading ' the automatic events will be raised on the page e.g. if the id = "mycomp" then the event will be mycomp_Click(params as Map) ' future: we'll see if some other mechanisme is needed for non automatic events Clear SetChartType("line") End Sub 'clear the contents of the chart Sub Clear highLight.Initialize highLight.show = False highLight.sizeAdjust = 0 highLight.showMarker = True highLight.tooltipAxes = "" highLight.tooltipAxes = "" highLight.yvalues = 0 highLight.formatString = "" cursor.Initialize cursor.show = True cursor.tooltipLocation = "" SingleSeries = False markerStyle.Initialize markerStyle.circle = "circle" markerStyle.diamond = "diamond" markerStyle.x = "x" linePattern.Initialize linePattern.dashed = "dashed" linePattern.dotted = "dotted" Renderer.Initialize Renderer.LogAxisRenderer = "$.jqplot.LogAxisRenderer" Renderer.CanvasAxisLabelRenderer = "$.jqplot.CanvasAxisLabelRenderer" Renderer.BarRenderer = "$.jqplot.BarRenderer" Renderer.CategoryAxisRenderer = "$.jqplot.CategoryAxisRenderer" Renderer.DateAxisRenderer = "$.jqplot.DateAxisRenderer" ChartType.Initialize ChartType.bar = "bar" ChartType.line = "line" ChartType.pie = "pie" mChartType = ChartType.line mTitle = "" mWidth = "100%" mHeight = "500px" barGroupMargin = 4 TopMargin = 30 BottomMargin = 10 RightMargin = 10 LeftMargin = 30 drawGridlines = True Series.Initialize SeriesColors.Initialize DataRows.Initialize axesDefaults.Initialize axesDefaults.xyMin = 0 axesDefaults.xyMax = 0 axesDefaults.xAxis.Initialize axesDefaults.xAxis.renderer = "" axesDefaults.xAxis.label = "" axesDefaults.xAxis.pad = "" axesDefaults.xAxis.yMax = 0 axesDefaults.xAxis.yMin = 0 axesDefaults.xAxis.numberTicks = 0 axesDefaults.xAxis.ticks.Initialize axesDefaults.yAxis.Initialize axesDefaults.yAxis.renderer = "" axesDefaults.yAxis.yMax = 0 axesDefaults.yAxis.yMin = 0 axesDefaults.yAxis.label = "" axesDefaults.yAxis.pad = "" axesDefaults.yAxis.numberTicks = 0 axesDefaults.yAxis.ticks.Initialize axesDefaults.labelRenderer = Renderer.CanvasAxisLabelRenderer axesDefaults.xAxis.tickOptions.Initialize axesDefaults.xAxis.tickOptions.formatString = "" axesDefaults.yAxis.tickOptions.Initialize axesDefaults.yAxis.tickOptions.formatString = "" seriesDefaults.Initialize seriesDefaults.showMarker = True seriesDefaults.renderer = "" seriesDefaults.rendererOptions.Initialize seriesDefaults.rendereroptions.varyBarColor = False seriesDefaults.rendereroptions.smooth = False seriesDefaults.rendererOptions.animation.show = False seriesDefaults.markerOptions.Initialize seriesDefaults.markerOptions.show = True SeriesOptions.Initialize End Sub 'what happens when a mouse pointer is placed over a point, show details Sub SetHighlighter(bShow As Boolean, sizeAdjust As Double) highLight.show = bShow highLight.sizeAdjust = sizeAdjust End Sub 'set the cursor visibility and tooltip location Sub SetCursor(bShow As Boolean, sToolTipLocation As String) cursor.show = bShow cursor.tooltipLocation = sToolTipLocation End Sub 'set XAxisTickOptionsFormatString Sub SetXAxisTickOptionsFormatString(fs As String) axesDefaults.xAxis.tickOptions.formatString = fs End Sub 'set YAxisTickOptionsFormatString Sub SetYAxisTickOptionsFormatString(fs As String) axesDefaults.YAxis.tickOptions.formatString = fs End Sub 'show markers or not Sub ShowMarkers(bs As Boolean) seriesDefaults.showMarker = bs End Sub 'has varying colors or not Sub UseVaryingColors(bv As Boolean) seriesDefaults.rendererOptions.varyBarColor = bv End Sub 'is chart smooth or not Sub IsSmooth(bs As Boolean) seriesDefaults.rendererOptions.smooth = bs End Sub 'is chart animated or not Sub IsAnimated(bv As Boolean) seriesDefaults.rendererOptions.animation.show = bv End Sub 'set the min and max for y axis 'this is the starting point on x axis and ending point Sub SetYAxisMinMax(yMin As Object, yMax As Object) axesDefaults.yAxis.yMin = yMin axesDefaults.yAxis.yMax = yMax End Sub 'set the width and height of the chart Sub SetWidthHeight(Width As String, Height As String) mHeight = Height mWidth = Width End Sub 'set the title of the chart Sub SetTitle(Title As String) mTitle = Title End Sub 'set all titles Sub SetTitles(Title As String, xAxisTitle As String, yAxisTitle As String) mTitle = Title axesDefaults.xAxis.label = xAxisTitle axesDefaults.yAxis.label = yAxisTitle End Sub 'set titles for x axis and y axis Sub SetAxisTitles(xAxisTitle As String, yAxisTitle As String) axesDefaults.xAxis.label = xAxisTitle axesDefaults.yAxis.label = yAxisTitle End Sub 'add specific ticks to the x axis Sub AddXAxisTick(v As Int) axesDefaults.xAxis.ticks.Add(v) End Sub Sub AddYAxisTick(v As Int) axesDefaults.YAxis.ticks.Add(v) End Sub 'set the x axis title for the chart Sub SetXAxisTitle(XAxisTitle As String) axesDefaults.xAxis.label = XAxisTitle End Sub 'set deafult marker options Sub SeriesDefaultsMarkerOptionsShow(bv As Boolean) seriesDefaults.markerOptions.Show = bv End Sub 'Set the y axis title for the chart Sub SetYAxisTitle(YAxisTitle As String) axesDefaults.yAxis.label = YAxisTitle End Sub 'set the chart type Sub SetChartType(sChartType As String) mChartType = sChartType.tolowercase Select Case mChartType Case ChartType.line seriesDefaults.renderer = "" axesDefaults.xAxis.renderer = "" Case ChartType.bar seriesDefaults.renderer = Renderer.BarRenderer axesDefaults.xAxis.renderer = Renderer.CategoryAxisRenderer End Select End Sub Sub Map2Json(m As Map) As String Dim gen As JSONGenerator Dim outJSON As String gen.Initialize(m) outJSON = gen.ToString Return outJSON End Sub 'set the series options Sub AddSeriesOptions(seriesName As String, slinePattern As String, iLineWidth As Int, sMarkerStyle As String, iMarkerSize As Int, showLine As Boolean) Dim sb As StringBuilder sb.Initialize sb.Append("{") If slinePattern.Length > 0 Then sb.Append("linePattern: '").Append(slinePattern).Append("'").Append(",") End If If iLineWidth > 0 Then sb.Append("lineWidth: ").Append(iLineWidth).Append(",") End If If showLine = False Then sb.Append("showLine: false").Append(",") End If sb.Append("markerOptions: {") If sMarkerStyle.length > 0 Then sb.Append("style: '").Append(sMarkerStyle).Append("'").Append(",") End If If iMarkerSize > 0 Then sb.Append("size : ").Append(iMarkerSize).Append(",") End If sb.Append("}").Append(",") sb.Append("}") SeriesOptions.Add(sb.tostring) End Sub 'add a category to the chart i.e column or tick label 'these will be the legend details 'Sub AddCategory(categoryName As String) ' categoryName = QUOTE & categoryName & QUOTE ' If Categories.Size > 0 Then ' Categories.Add("," & categoryName) ' Else ' Categories.Add(categoryName) ' End If 'End Sub 'get the categories for this chart 'Private Sub GetCategories() As String ' Dim sb As StringBuilder ' sb.Initialize ' For Each strCategory As String In Categories ' sb.Append(strCategory) ' Next ' Return sb.ToString 'End Sub 'add a data row with 10 elements Sub AddSeriesData10(v1 As Object,v2 As Object,v3 As Object,v4 As Object,v5 As Object,v6 As Object, v7 As Object, v8 As Object, v9 As Object, v10 As Object) DataRows.Add($"[${v1}, ${v2}, ${v3}, ${v4}, ${v5}, ${v6}, ${v7}, ${v8}, ${v9}, ${v10}]"$) End Sub 'add a data row with 9 elements Sub AddSeriesData9(v1 As Object,v2 As Object,v3 As Object,v4 As Object,v5 As Object,v6 As Object, v7 As Object, v8 As Object, v9 As Object) DataRows.Add($"[${v1}, ${v2}, ${v3}, ${v4}, ${v5}, ${v6}, ${v7}, ${v8}, ${v9}]"$) End Sub 'add a data row with 8 elements Sub AddSeriesData8(v1 As Object,v2 As Object,v3 As Object,v4 As Object,v5 As Object,v6 As Object, v7 As Object, v8 As Object) DataRows.Add($"[${v1}, ${v2}, ${v3}, ${v4}, ${v5}, ${v6}, ${v7}, ${v8}]"$) End Sub 'add a data row with 7 elements Sub AddSeriesData7(v1 As Object,v2 As Object,v3 As Object,v4 As Object,v5 As Object,v6 As Object,v7 As Object) DataRows.Add($"[${v1}, ${v2}, ${v3}, ${v4}, ${v5}, ${v6}, , ${v7}]"$) End Sub 'add a data row with 6 elements Sub AddSeriesData6(v1 As Object,v2 As Object,v3 As Object,v4 As Object,v5 As Object,v6 As Object) DataRows.Add($"[${v1}, ${v2}, ${v3}, ${v4}, ${v5}, ${v6}]"$) End Sub 'add a data row with 5 elements Sub AddSeriesData5(v1 As Object,v2 As Object,v3 As Object,v4 As Object,v5 As Object) DataRows.Add($"[${v1}, ${v2}, ${v3}, ${v4}, ${v5}]"$) End Sub 'add a data row with 4 elements Sub AddSeriesData4(v1 As Object,v2 As Object,v3 As Object,v4 As Object) DataRows.Add($"[${v1}, ${v2}, ${v3}, ${v4}]"$) End Sub 'add a data row with 3 elements Sub AddSeriesData3(v1 As Object,v2 As Object,v3 As Object) DataRows.Add($"[${v1}, ${v2}, ${v3}]"$) End Sub 'add a data row with 2 elements Sub AddSeriesData2(v1 As Object,v2 As Object) DataRows.Add($"[${v1}, ${v2}]"$) End Sub 'add a data row with 1 element Sub AddSeriesData1(v1 As Object) DataRows.Add($"[${v1}]"$) End Sub 'RGBA Color Sub GetRGBA(r As Int, g As Int, b As Int, a As Double) As String Dim sb As StringBuilder sb.Initialize sb.Append("rgba(").Append(r).Append(",") sb.Append(g).Append(",").Append(b).Append(",").Append(a) sb.Append(")") Return sb.tostring End Sub 'RGBA Color Sub GetRGB(r As Int, g As Int, b As Int) As String Dim sb As StringBuilder sb.Initialize sb.Append("rgb(").Append(r).Append(",") sb.Append(g).Append(",").Append(b) sb.Append(")") Return sb.tostring End Sub 'get the series for this chart 'Private Sub GetSeries() As String ' Dim sb As StringBuilder ' sb.Initialize ' For Each strSeries As String In Series ' sb.Append(strSeries) ' Next ' Return sb.ToString 'End Sub 'get the series colors for this chart 'Private Sub GetSeriesColors() As String ' Dim sb As StringBuilder ' sb.Initialize ' For Each strColor As String In SeriesColors ' sb.Append(strColor) ' Next ' Return sb.ToString 'End Sub 'add a tick label to the chart 'Sub AddTickLabel(tickLabel As String) ' AddCategory(tickLabel) 'End Sub 'add a series to the chart, a series is like a row key/id Sub AddSeries(seriesName As String, seriesColor As String) seriesName = QUOTE & seriesName & QUOTE seriesColor = QUOTE & seriesColor & QUOTE Series.Add(seriesName) SeriesColors.Add(seriesColor) End Sub 'add a series to the chart, a series is like a row key/id Sub AddSeriesRGBA(seriesName As String, r As Int, g As Int, b As Int, a As Double) Dim seriesColor As String seriesName = QUOTE & seriesName & QUOTE seriesColor = QUOTE & GetRGBA(r,g,b,a) & QUOTE Series.Add(seriesName) SeriesColors.Add(seriesColor) End Sub 'add a series to the chart, a series is like a row key/id Sub AddSeriesRGB(seriesName As String, r As Int, g As Int, b As Int) Dim seriesColor As String seriesName = QUOTE & seriesName & QUOTE seriesColor = QUOTE & GetRGB(r,g,b) & QUOTE Series.Add(seriesName) SeriesColors.Add(seriesColor) End Sub 'get the margins of the chart private Sub GetMargins() As String Dim sb As StringBuilder sb.Initialize sb.Append("top:").Append(TopMargin).Append(",") sb.Append("right:").Append(RightMargin).Append(",") sb.Append("bottom:").Append(BottomMargin).Append(",") sb.Append("left:").Append(LeftMargin) Return sb.tostring End Sub 'build the options for the chart private Sub GetOptions() As String Dim sb As StringBuilder sb.Initialize 'define the ticks for the x axis If (axesDefaults.xAxis.ticks.Size - 1) <> -1 Then sb.Append("var xticks = [];").Append(CRLF) axesDefaults.xAxis.ticks.Sort(True) For Each strTick As String In axesDefaults.xAxis.ticks sb.Append("xticks.push(").Append(strTick).Append(");").Append(CRLF) Next End If 'define the ticks for the y axis If (axesDefaults.yAxis.ticks.Size - 1) <> -1 Then sb.Append("var yticks = [];").Append(CRLF) axesDefaults.yAxis.ticks.Sort(True) For Each strTick As String In axesDefaults.yAxis.ticks sb.Append("yticks.push(").Append(strTick).Append(");").Append(CRLF) Next End If 'define the series colors If (SeriesColors.Size - 1) <> -1 Then sb.Append("var sColors = [];").Append(CRLF) For Each strColor As String In SeriesColors sb.Append("sColors.push(").Append(strColor).Append(");").Append(CRLF) Next End If ' define series options If (SeriesOptions.Size - 1) <> -1 Then sb.Append("var sOptions = [];").Append(CRLF) For Each sOption As String In SeriesOptions sb.Append("sOptions.push(").Append(sOption).Append(");").Append(CRLF) Next End If sb.Append("var options = {").Append(CRLF) 'define the title of the chart sb.Append("title: '").Append(mTitle).Append("'").Append(",").Append(CRLF) 'define the series colors If (SeriesColors.Size - 1) <> -1 Then sb.Append("seriesColors: sColors").Append(",").Append(CRLF) End If 'define series options If (SeriesOptions.Size - 1) <> -1 Then sb.Append("series: sOptions").Append(",").Append(CRLF) End If 'define series defaults sb.Append("seriesDefaults: {").Append(CRLF) If seriesDefaults.showMarker = False Then sb.Append("showMarker: false").Append(",").Append(CRLF) End If If seriesDefaults.Renderer.Length > 0 Then sb.Append("renderer: ").Append(seriesDefaults.renderer).Append(",").Append(CRLF) End If If seriesDefaults.markerOptions.Show = False Then sb.Append("markerOptions:{").Append(CRLF) sb.Append("show: false").Append(",").Append(CRLF) sb.Append("}").Append(",").Append(CRLF) End If sb.Append("rendererOptions:{").Append(CRLF) If seriesDefaults.rendererOptions.varyBarColor = True Then sb.Append("varyBarColor: true").Append(",").Append(CRLF) End If If seriesDefaults.rendererOptions.smooth = True Then sb.Append("smooth: true").Append(",").Append(CRLF) End If If seriesDefaults.rendereroptions.animation.show = True Then sb.Append("animation: {show: true}").Append(",").Append(CRLF) End If sb.Append("},").append(CRLF) sb.Append("},").Append(CRLF) 'define the default axes properties (applies to both) sb.Append("axesDefaults:{").Append(CRLF) If axesDefaults.xyMax > 0 And axesDefaults.xyMin >= 0 Then sb.Append("min: ").Append(axesDefaults.xyMin).Append(",").Append(CRLF) sb.Append("max: ").Append(axesDefaults.xyMax).Append(",").Append(CRLF) End If If axesDefaults.labelRenderer.Length > 0 Then sb.Append("labelRenderer: ").Append(axesDefaults.labelRenderer).Append(",").Append(CRLF) End If sb.Append("},").Append(CRLF) 'define the axes default properties sb.Append("axes:{").Append(CRLF) sb.Append("yaxis:{").Append(CRLF) If axesDefaults.yAxis.yMax > 0 And axesDefaults.yAxis.yMin >= 0 Then sb.Append("min: ").Append(axesDefaults.yAxis.yMin).Append(",").Append(CRLF) sb.Append("max: ").Append(axesDefaults.yAxis.yMax).Append(",").Append(CRLF) End If If axesDefaults.yAxis.Renderer.Length > 0 Then sb.Append("renderer: ").Append(axesDefaults.yAxis.renderer).Append(",").Append(CRLF) End If sb.Append("tickOptions:{").append(CRLF) If axesDefaults.yAxis.tickOptions.formatString.Length > 0 Then sb.Append("formatString: ").Append(axesDefaults.yAxis.tickOptions.formatString).Append(",").Append(CRLF) End If sb.Append("}").Append(",").Append(CRLF) If axesDefaults.yAxis.label.Length > 0 Then sb.Append("label: ").Append(QUOTE).Append(axesDefaults.yAxis.label).Append(QUOTE).Append(",").Append(CRLF) End If If axesDefaults.yAxis.pad.Length > 0 Then sb.Append("pad: ").Append(axesDefaults.yAxis.pad).Append(",").Append(CRLF) End If If axesDefaults.yAxis.numberticks > 0 Then sb.Append("numberTicks: ").Append(axesDefaults.yAxis.numberTicks).Append(",").Append(CRLF) End If If (axesDefaults.yAxis.ticks.Size -1) <> -1 Then sb.Append("ticks: yticks").Append(",").Append(CRLF) End If sb.Append("},").Append(CRLF) sb.Append("xaxis:{").Append(CRLF) If axesDefaults.xAxis.yMax > 0 And axesDefaults.xAxis.yMin >= 0 Then sb.Append("min: ").Append(axesDefaults.xAxis.yMin).Append(",").Append(CRLF) sb.Append("max: ").Append(axesDefaults.xAxis.yMax).Append(",").Append(CRLF) End If If axesDefaults.xAxis.Renderer.Length > 0 Then sb.Append("renderer: ").Append(axesDefaults.xAxis.renderer).Append(",").Append(CRLF) End If sb.Append("tickOptions:{").append(CRLF) If axesDefaults.xAxis.tickOptions.formatString.Length > 0 Then sb.Append("formatString: ").Append(axesDefaults.xAxis.tickOptions.formatString).Append(",").Append(CRLF) End If sb.Append("}").Append(",").Append(CRLF) If axesDefaults.xAxis.label.Length > 0 Then sb.Append("label: ").Append(QUOTE).Append(axesDefaults.xAxis.label).Append(QUOTE).Append(",").Append(CRLF) End If If axesDefaults.xAxis.pad.Length > 0 Then sb.Append("pad: ").Append(axesDefaults.xAxis.pad).Append(",").Append(CRLF) End If If axesDefaults.xAxis.numberticks > 0 Then sb.Append("numberTicks: ").Append(axesDefaults.xAxis.numberTicks).Append(",").Append(CRLF) End If If (axesDefaults.xAxis.ticks.Size -1) <> -1 Then sb.Append("ticks: xticks").Append(",").Append(CRLF) End If sb.Append("},").Append(CRLF) sb.Append("},").Append(CRLF) If drawGridlines = False Then sb.Append("grid:{drawGridlines: false}").Append(",").Append(CRLF) End If sb.Append("highlighter:{").Append(CRLF) If highLight.show = True Then sb.Append("show: ").Append(highLight.show).Append(",").Append(CRLF) End If If highLight.sizeAdjust > 0 Then sb.Append("sizeAdjust: ").Append(highLight.sizeAdjust).Append(",").Append(CRLF) End If sb.Append("}").Append(",").Append(CRLF) sb.Append("cursor:{").Append(CRLF) sb.Append("show: ").Append(cursor.show).Append(",").Append(CRLF) If cursor.tooltipLocation.Length > 0 Then sb.Append("tooltipLocation:'").Append(cursor.tooltipLocation).Append("'").Append(",") sb.Append(CRLF) End If sb.Append("}").Append(CRLF) sb.Append("};").Append(CRLF) Return sb.tostring End Sub 'set the x axis numberticks Sub SetXAxisNumberTicks(v As Int) axesDefaults.xAxis.numberTicks = v End Sub 'set the x axis numberticks Sub SetYAxisNumberTicks(v As Int) axesDefaults.yAxis.numberTicks = v End Sub 'set the x axis min Sub SetXAxisMin(v As Object) axesDefaults.xAxis.yMin = v End Sub 'set the x axis min Sub SetXAxisMax(v As Object) axesDefaults.xAxis.ymax = v End Sub 'set the x axis min Sub SetYAxisMin(v As Object) axesDefaults.yAxis.yMin = v End Sub Sub SetYAxisMax(v As Object) axesDefaults.yAxis.ymax = v End Sub 'set the x axis min max values Sub SetXAxisMinMax(xmin As Object, xmax As Object) axesDefaults.xAxis.yMin = xmin axesDefaults.xAxis.yMax = xmax End Sub 'set the padding of the x axis Sub SetXAxisPadding(v As Int) axesDefaults.xAxis.pad = v End Sub 'set the padding of the y axis Sub SetYAxisPadding(v As Int) axesDefaults.yAxis.pad = v End Sub 'return the script of the control public Sub ToString() As String Return GetScript(ABMComp.ID) End Sub 'build the data for the chart private Sub GetData() As String Dim sb As StringBuilder sb.Initialize sb.Append("var data = [];").Append(CRLF) For Each strData As String In DataRows sb.Append("data.push(").Append(strData).Append(");").Append(CRLF) Next If SingleSeries = True Then sb.Append("var singleData = [];").Append(CRLF) sb.Append("singleData.push(data);").Append(CRLF) sb.Append("data = singleData;").Append(CRLF) End If Return sb.tostring End Sub 'set the render for the x axis Sub SetXAxisRenderer(r As String) axesDefaults.xAxis.Renderer = r End Sub 'set the render for the y axis Sub SetYAxisRenderer(r As String) axesDefaults.yAxis.Renderer = r End Sub ' runs when an object is created for the first time. Expects a valid html string Sub ABMComp_Build(internalID As String) As String InitString = $"
"$ Return InitString End Sub 'build the charting script private Sub GetScript(internalID As String) As String Dim sb As StringBuilder sb.Initialize sb.Append(GetOptions) sb.Append(GetData) sb.Append("$.jqplot('").append(internalID).append("', data, options);").append(CRLF) Return sb.tostring End Sub ' Is useful to run some initalisation script. Sub ABMComp_FirstRun(InternalPage As ABMPage, internalID As String) Dim script As String = GetScript(internalID) InternalPage.ws.Eval(script, Array As Object(ABMComp.ID)) ' flush not needed, it's done in the refresh method in the lib End Sub ' runs when a refresh is called Sub ABMComp_Refresh(InternalPage As ABMPage, internalID As String) ' use these methods to adjust the object ' ABM.HasClass ' ABM.AddClass ' ABM.RemoveClass ' ABM.AddHTML ' ABM.InsertHTMLAfter ' ABM.RemoveHTML ' ABM.GetProperty ' ABM.SetProperty ' ABM.RemoveProperty ' ABM.GetStyleProperty ' ABM.SetStyleProperty ' do some script stuff like you do in RunJavaScript 'Dim script As String = "" 'InternalPage.ws.Eval(script, Null) End Sub ' do the stuff needed when the object is removed Sub ABMComp_CleanUp(InternalPage As ABMPage, internalID As String) End Sub