To ensure the VChart capability in the Harmony environment, the native Canvas in the Harmony environment has been encapsulated to provide the interface of the browser's Canvas2D.
The component encapsulation logic in the harmony environment is located in the packages/harmony_vchart/library/src/main/ets/ChartComponent.ets directory, which includes components encapsulated based on the harmony environment.
The events of Harmony have been re-encapsulated to be compatible with the browser's event interface.
The event compatibility logic is located in the packages/harmony_vchart/library/src/main/ets/event.ets directory.
Since there is no RequestAnimationFrame interface in the Harmony environment, a custom Ticker, HarmonyTickHandler, is implemented based on Harmony's own animation API.
The animation Ticker logic is located in the packages/harmony_vchart/library/src/main/ets/ticker.ets directory.
Component Registration
The registration of components includes properties and necessary lifecycle declarations.
Component Properties:
spec: Same as the spec configuration of VChart
initOption: Same as the initOption configuration of VChart;
Component Methods:
onChartInitCb: Provides a callback for when initialization is complete
onChartReadyCb: Provides a callback for when the chart is ready to be drawn
This document was revised and organized by the following personnel