//TH-Header //***************************************************************************************** // Copyright (c) 2022 Antwise Solutions // All rights reserved. // // $FileName : SyncFusion\AppSrc\csfWebAccumulationChart.pkg // $ProjectName : SyncFusion Library // $Authors : Wil van Antwerpen // $Created : 2022-09-05 // // Contents: // This is a web framework wrapper class for the SyncFusion AccumulationChart control. // We would normally call that a PieChart control, but we're staying close to the // syncfusion naming, at least for now. // // Documentation for the API is here: // https://ej2.syncfusion.com/documentation/api/accumulation-chart/overview/ // and tips & tricks here: // https://ej2.syncfusion.com/javascript/documentation/accumulation-chart/es5-getting-started/ // SyncFusion Chart control demo: // https://ej2.syncfusion.com/javascript/demos/#/material/chart/default-pie.html //***************************************************************************************** //TH-RevisionStart // ******************** // MODIFICATION SUMMARY // ******************** // ####### DD/MM/YYYY WHO COMMENT //TH-RevisionEnd Use csfWebChartBase.pkg Use csfWebChartAccumulationSeries.pkg Struct tsfWebAccumulationChartConfig tsfWebChartAccumulationSeries[] Series tsfWebChartArea Area tsfWebChartTooltip Tooltip End_Struct Class csfWebAccumulationChart is a csfWebChartBase Procedure Construct_Object Forward Send Construct_Object // // If set true, labels for the point will be placed smartly without overlapping. // Default = true { WebProperty=Client } Property Boolean pbEnableSmartLabels True // // Specifies whether point has to get selected or not. Takes value either "None"or "Point" // None: Disables the selection. Point: selects a point. // Default = "None" { EnumList="None, Point" } { InitialValue="None" } { WebProperty=Client } Property String psSelectionMode "None" // Private properties used for configuring the chart control. Property Handle[] pSeriesHandles Set psJSClass To "sf.WebAccumulationChart" End_Procedure Procedure InitializeDefaults Send ClientAction "initializeDefaults" End_Procedure { Visibility=Private } Procedure RegisterSeries Handle hoSeries Handle[] SeriesHandles If (hoSeries<>0) Begin Get pSeriesHandles To SeriesHandles Move hoSeries To SeriesHandles[SizeOfArray(SeriesHandles)] Set pSeriesHandles To SeriesHandles End End_Procedure { Visibility=Private } Function LoadSeriesProtoTypes Returns tsfWebChartAccumulationSeries[] Handle hoSeries Integer iItem Integer iCount Handle[] SeriesHandles tsfWebChartAccumulationSeries Series tsfWebChartAccumulationSeries[] SeriesPrototypes Get pSeriesHandles To SeriesHandles Move (SizeOfArray(SeriesHandles)) To iCount For iItem From 0 To (iCount-1) Move SeriesHandles[iItem] To hoSeries If (hoSeries<>0) Begin Move (SizeOfArray(SeriesPrototypes)) To iItem Set psObjectId Of hoSeries to (string(iItem)) Get LoadWebChartSeriesProperties of hoSeries To Series Move Series To SeriesPrototypes[iItem] End Loop Function_Return SeriesPrototypes End_Function { Visibility=Private } Procedure ConnectChartSeries Integer iItem Integer iCount Handle hoSeries Handle[] SeriesHandles Get pSeriesHandles To SeriesHandles Move (SizeOfArray(SeriesHandles)) To iCount For iItem From 0 To (iCount-1) Move SeriesHandles[iItem] To hoSeries If (hoSeries) Begin Send ConnectSeries Of hoSeries End Loop For iItem From 0 To (iCount-1) Move SeriesHandles[iItem] To hoSeries If (hoSeries) Begin Send LoadSeriesData Of hoSeries End Loop End_Procedure { Visibility=Private } Procedure ConfigureChartControl String[] asParams tWebValueTree tVT tsfWebAccumulationChartConfig Config tsfWebChartAccumulationSeries[] SeriesPrototypes tsfWebChartArea AreaPrototype tsfWebChartTooltip TooltipPrototype Get LoadAreaPrototype to AreaPrototype If (phoChartArea(Self)<>0) Begin Move AreaPrototype to Config.Area End Get LoadTooltipPrototype to TooltipPrototype If (phoChartTooltip(Self)<>0) Begin Move TooltipPrototype to Config.Tooltip End Get LoadSeriesProtoTypes to SeriesPrototypes If (SizeOfArray(SeriesPrototypes)>0) Begin Move SeriesPrototypes to Config.Series ValueTreeSerializeParameter Config To tVT Send ClientAction "configureChartControl" asParams tVT Send doPostConfigureChart Send doRenderChart End End_Procedure Procedure End_Construct_Object Forward Send End_Construct_Object End_Procedure End_Class