GChart
Properties
Section titled “Properties”dataSource
Section titled “dataSource”type: GDataSource
required: true
The data source for the chart. This is where the chart gets its data from.
panels
Section titled “panels”type: List<GPanel>
required: true
The list of panels in the chart. each panel has its own graphs and axes.
pointViewPort
Section titled “pointViewPort”type: GPointViewPort
required: false
default: GPointViewPort(autoScaleStrategy: const GPointViewPortAutoScaleStrategyLatest())
The viewport which controls the visible points range along the x axis on the chart.
The visible range of all panels, x axes and graphs are synchronized so there is only one instance.
Set to your own instance to customize its behavior.
background
Section titled “background”type: GBackground
required: false
default: GBackground()
The background component which draws the background of the chart.
The default will draw a colored rectangle. extend the GBackground class to customize the background drawing.
splitter
Section titled “splitter”type: GSplitter
required: false
default: GSplitter()
The splitter component which being used to resize panels. all panels share the same splitter instance.
Set to your own instance to customize.
crosshair
Section titled “crosshair”type: GCrosshair
required: false
default: GCrosshair()
The crosshair component which draws crosshair lines on the chart when mouse is hovered over the chart area.
Set to your own instance to customize.
pointerScrollMode
Section titled “pointerScrollMode”type: GPointerScrollMode
required: false
default: GPointerScrollMode.zoom
Defines the behavior of the chart when mouse wheel is scrolled over the chart area.
See the enum values for more details.
hitTestEnable
Section titled “hitTestEnable”type: bool
required: false
default: true
This is for disable hit test on all components in the chart globally.
When it is set to true, whether a component can be hit by mouse events is determined by the component’s own hitTestMode property.
When it is set to false, the hitTestMode property of all components will be ignored.
type: Rect
required: false
default: const Rect.fromLTWH(0, 0, 500, 500)
This is for read only. the size of the chart area will be always calculated from size of parent GChartWidget widget.
minSize
Section titled “minSize”type: Size
required: false
default: const Size(200, 200)
The minimum size of the chart area.
preRender
Section titled “preRender”type: void Function(GChart chart, Canvas canvas, Rect area)
required: false
default: null
The pre-render callback which is called right before rendering.
postRender
Section titled “postRender”type: void Function(GChart chart, Canvas canvas, Rect area)
required: false
default: null
The post-render callback which is called right after rendering.
GPointerScrollMode
Section titled “GPointerScrollMode”values:
none: No action when mouse wheel is scrolled over the chart area.zoom: Zoom in or out the chart over x axis by changing thepointViewPort’.move: Scroll the chart over x axis by changing thepointViewPort’.
Methods
Section titled “Methods”addPanel
Section titled “addPanel”void addPanel(GPanel panel)Add a panel to the chart.
removePanel
Section titled “removePanel”void removePanel(GPanel panel)Remove a panel from the chart.
saveAsImage
Section titled “saveAsImage”Future<Image> saveAsImage()Export the chart as an image.
autoScaleViewports
Section titled “autoScaleViewports”void autoScaleViewports({ bool resetPointViewPort = true, bool resetValueViewPort = true, bool animation = true,})Reset the scale of the viewports use their own auto scale strategy.
hitTestPanelGraphs
Section titled “hitTestPanelGraphs”(GPanel, GGraph, GOverlayMarker?)? hitTestPanelGraphs({ required Offset position,})Get hit test result of the panel graphs at the given position.
When it hits a graph, it will return the panel, graph with a null marker.
When it hits a marker, it will return the panel, graph and the marker.
repaint
Section titled “repaint”void repaint({bool layout = true})Redraw the chart. call this method when you updated the chart data or properties that requires a re-paint.