//TH-Header //***************************************************************************************** // Copyright (c) 2022 Antwise Solutions // All rights reserved. // // $FileName : SyncFusion\AppSrc\csfWebChartSeries.pkg // $ProjectName : SyncFusion Library // $Authors : Wil van Antwerpen // $Created : 2022-08-28 15:50 // // Contents: // This is used for loading the data that you can use in a csfWebChart // // Documentation for the API is here: // https://ej2.syncfusion.com/documentation/api/chart/series/ // // //***************************************************************************************** //TH-RevisionStart // ******************** // MODIFICATION SUMMARY // ******************** // ####### DD/MM/YYYY WHO COMMENT //TH-RevisionEnd Use csfWebChartChild.pkg Use csfWebChartMarker.pkg Use cJsonObject.pkg Struct tSeriesDataSource String sDataManager End_Struct // https://ej2.syncfusion.com/documentation/api/chart/series/ Struct tsfWebChartSeries tsfWebChartAnimation animation tsfWebChartBorderModel border String sClose String sColorName Number nColumnSpacing Boolean bEnableTooltip String sGroupName String sHigh String sLegendImageUrl String sLegendShape String sLow tsfWebChartMarkerSettings[] marker // array to be able to pass no markers String sName String sObjectId Number nOpacity String sOpen String sPointColorMapping String sTooltipFormat String sTooltipMappingName String sType Boolean bVisible Integer iWidth String sXAxisName String sXName String sYAxisName String sYName Integer iZOrder tSeriesDataSource DataSource End_Struct { OverrideProperty=pbFillHeight Visibility=Private } { OverrideProperty=phoMarkerSettings Visibility=Private } Class csfWebChartSeries Is a csfWebChartChild Procedure Construct_Object Forward Send Construct_Object Property String psObjectId "" // private, we need a way to link to the series at the js object // Options to customizing the border of the series. // This is applicable only for Column and Bar type series. // // The option to delay animation of the series. { WebProperty=Client } Property Integer piAnimationDelay C_WebDefault // The duration of animation in milliseconds. { WebProperty=Client } Property Integer piAnimationDuration C_WebDefault // { WebProperty=Client } Property String psBorderColor "" // Set the width in pixels. If the width is -1 (C_WebDefault) then it will // use the default. { WebProperty=Client } Property Integer piBorderWidth C_WebDefault { WebProperty=Client } Property String psClose "" { WebProperty=Client } Property String psColorName "" { WebProperty=Client } Property Number pnColumnSpacing 0.0 // If set true, the Tooltip for series will be visible. // Default = true { WebProperty=Client } Property Boolean pbEnableTooltip True // If set to true, series gets animated on initial loading. // Default = true { WebProperty=Client } Property Boolean pbEnableAnimation True { WebProperty=Client } Property String psGroupName "" { WebProperty=Client } Property String psHigh "" { WebProperty=Client } Property String psLegendImageUrl "" { EnumList="Circle, Rectangle, Triangle, Diamond, Cross, HorizontalLine, VerticalLine, Pentagon, InvertedTriangle, SeriesType, Image" } { InitialValue="SeriesType" } { WebProperty=Client } Property String psLegendShape "SeriesType" { WebProperty=Client } Property String psLow "" { WebProperty=Client } Property String psName "" // Set the opacity in a value between 0.0 and 1.0. If the opacity is -1 (C_WebDefault) then it will // use the default of 1.0 { WebProperty=Client } Property Number pnOpacity C_WebDefault { WebProperty=Client } Property String psOpen "" { WebProperty=Client } Property String psPointColorMapping "" // user can now format each series tooltip format separately. // Defaults to "" { WebProperty=Client } Property String psTooltipFormat "" // The provided value will be considered as a Tooltip name // Defaults to "" { WebProperty=Client } Property String psTooltipMappingName "" { EnumList="Line, Column, Area, Bar, Histogram, StackingColumn, StackingArea, StackingBar, StepLine, StepArea, Scatter, Spline, StackingColumn100, StackingBar100, StackingArea100, RangeColumn, Hilo, HiloOpenClose, Waterfall, RangeArea, SplineRangeArea, Bubble, Candle, Polar, Radar, BoxAndWhisker, Pareto" } { InitialValue="Line" } { WebProperty=Client } Property String psType "Line" { WebProperty=Client } Property Boolean pbVisible True // Set the width in pixels. If the width is -1 (C_WebDefault) then it will // use the default. { WebProperty=Client } Property Integer piWidth C_WebDefault { WebProperty=Client } Property String psXAxisName "" { WebProperty=Client } Property String psXName "" { WebProperty=Client } Property String psYAxisName "" { WebProperty=Client } Property String psYName "" { WebProperty=Client } Property Integer piZOrder 0 // We set this to false, so we can detect if a DAW webcolumn was dropped // as it will have this set to true. Property Boolean pbIsWebColumn False Property Handle phoJSONData Property Handle phoMarkerSettings // Set psJSClass To "sf.WebChartSeries" End_Procedure Function LoadWebChartSeriesProperties Returns tsfWebChartSeries Handle hoMarker String sXName String sYName String sXAxisName String sYAxisName tsfWebChartSeries Series tsfWebChartMarkerSettings Marker Get psObjectId To Series.sObjectId Get piAnimationDelay To Series.animation.iDelay Get piAnimationDuration To Series.animation.iDuration Get pbEnableAnimation To Series.animation.bEnable Get psBorderColor To Series.border.sColor Get piBorderWidth To Series.border.iWidth Get psClose To Series.sClose Get psColorName To Series.sColorName Get pnColumnSpacing To Series.nColumnSpacing Get pbEnableTooltip To Series.bEnableTooltip Get psGroupName To Series.sGroupName Get psHigh To Series.sHigh Get psLegendImageUrl To Series.sLegendImageUrl Get psLegendShape To Series.sLegendShape Get psLow To Series.sLow Get psName To Series.sName Get pnOpacity To Series.nOpacity Get psOpen To Series.sOpen Get psPointColorMapping To Series.sPointColorMapping Get psTooltipFormat To Series.sTooltipFormat Get psTooltipMappingName To Series.sTooltipMappingName Get psType To Series.sType Get pbVisible To Series.bVisible get piWidth To Series.iWidth Get psXAxisName To sXAxisName If (sXAxisName="") Begin Delegate Get primaryXAxisName To sXAxisName Set psXAxisName to sXAxisName End Move sXAxisName To Series.sXAxisName Get psXName To sXName If (sXName="") Begin Move "x" To sXName // set a default if none is set Set psXName to sXName End Move sXName To Series.sXName Get psYAxisName To sYAxisName If (sYAxisName="") Begin Delegate Get primaryYAxisName To sYAxisName Set psYAxisName To sYAxisName End Move sYAxisName To Series.sYAxisName Get psYName To sYName If (sYName="") Begin Move "y" To sYName Set psYName To sYName End Move sYName To Series.sYName Get piZOrder To Series.iZOrder Get phoMarkerSettings To hoMarker If (hoMarker<>0) Begin Move (ResizeArray(Series.marker,1)) to Series.marker Get LoadWebChartMarkerProperties Of hoMarker To Marker Move Marker to Series.marker[0] End Function_Return Series End_Function Procedure ConnectSeries Handle hoMarker String[] aParams Get psObjectId to aParams[0] Send ClientAction "connectSeries" aParams Get phoMarkerSettings To hoMarker If (hoMarker) Begin Send ConnectMarker To hoMarker End End_Procedure { Visibility=Private } Procedure RegisterMarkerSettings Handle hoMarker If (hoMarker<>0) Begin Set phoMarkerSettings to hoMarker End End_Procedure // Procedure ClearData Send ClientAction "clearData" End_Procedure // Procedure LoadData String[] sData String[] aParams tWebValueTree tVT ValueTreeSerializeParameter sData to tVT Send ClientAction "loadData" aParams tVT End_Procedure Procedure AddPoint String sXValue String sYValue Handle hoJSON Handle hoROW Integer iDecSep String sXName String sYName Get phoJSONData To hoJSON If (hoJSON) Begin Get Create (RefClass(cJsonObject)) to hoRow Send InitializeJsonType Of hoRow jsonTypeObject Get psXName To sXName Get psYName To sYName Get_Attribute DF_DECIMAL_SEPARATOR to iDecSep If (iDecSep=44) Begin // if is comma then... Move (Replace(',',sXValue,'.')) To sXValue Move (Replace(',',sYValue,'.')) To sYValue End Send SetMemberValue of hoRow sXName jsonTypeString sXValue Send SetMemberValue of hoRow sYName jsonTypeString sYValue Send AddMember of hoJSON hoRow Send Destroy Of hoRow End Else Begin Send UserError "No JSON Data Object has been created." "Developer error." End End_Procedure // empty event to use for creating your data series Procedure OnAddChartData End_Procedure // Procedure UpdateData String[] sData String[] aParams tWebValueTree tVT ValueTreeSerializeParameter sData to tVT Send ClientAction "updateData" aParams tVT End_Procedure Procedure LoadPoint String sXValue String sYValue Handle hoJSON String[] SeriesData Get Create (RefClass(cJsonObject)) to hoJSON If (hoJSON) Begin Send InitializeJsonType Of hoJSON jsonTypeArray Set phoJSONData To hoJSON Send AddPoint sXValue sYValue Get JsonDataToStringArray hoJSON to SeriesData Send UpdateData SeriesData Set phoJSONData to 0 Send Destroy of hoJSON End End_Procedure Procedure LoadSeriesData Handle hoJSON String[] SeriesData Get Create (RefClass(cJsonObject)) to hoJSON If (hoJSON) Begin Send InitializeJsonType Of hoJSON jsonTypeArray Set phoJSONData To hoJSON Send OnAddChartData Get JsonDataToStringArray hoJSON to SeriesData Send LoadData SeriesData Set phoJSONData to 0 Send Destroy of hoJSON End End_Procedure Procedure End_Construct_Object Forward Send End_Construct_Object Delegate Send RegisterSeries Self End_Procedure End_Class