Abstract
Protected
constructorOptional
_tooltipOptional
extra_Optional
rootOptional
settingsOptional
unpinStatic
typesAdds a listener to the datastore that will be called when an event occurs, passing the event type and any data. There are the following different types of event:-
a unique id indetifying the listener
a function that accepts two paramaters, the type of event and the data associated with it
Adds a menu icon with tooltip to the title bar
the css classs of the icon (space delimited).
the tooltip text
extra inormation about the icon/tooltip
Optional
func?: (e: MouseEvent) => voida function that is called when the icon is clicked
Optional
position?: stringthe position of the tooltip.
Optional
size?: stringthe size of the tooltip
Optional
addOptional
colorOptional
colorOptional
getOptional
data: anyOptional
getReturns information about which controls to add to the settings dialog. Subclasses should call this method and then add their own controls e.g.
getSettings(){ let settings = super.getSettings(); return settings.concat([{ label:"A value" type:"slider", default_value:this.config.value, max:10, min:10, func:x=>{ this.config.value=x; //update chart } }]); }
wrapping controls with a call to @{link g} will perform type checking
todo- specifiy the link to g
above properly/ document better
an array of objects describing tweakable parameters
On rare occasions where you need to run a function that depends on mobx state, outside of a React component. This is a convenience method for creating a mobx autorun reaction that will be dispsed when the chart is removed.
The function to run
Optional
opts: IAutorunOptionsOptions for the autorun.
According to the docs you can pass an equals
option to specify a mobx comparer...
but it isn't in IAutorunOptions type, and it doesn't seem to be in the code either.
Check if chart is composed of any columns whose data has changed. if so re-calculate and re-draw chart (call onDataFiltered)
a list of column/fields whose data has been modified
Optional
pinOptional
removeSets the size of the graph. If no parameters are supplied then the graph will be resized based on it container. Subclasses should overide this, but call the super method first which will calculate width and height of the content div
Optional
x: numberThe new width
Optional
y: numberThe new height;
Optional
unpin
Base class for charts that use React.
Components should be functional, but will require a very thin wrapper class extending this, such that any BaseChart methods called from outside will appropriately affect the component state.
Internally, this class uses mobx to make the config object observable, and creates a React root with the given
ReactComponentFunction
. Use of MobX was originally intended to be hidden by this abstraction - but if we change to a different state management system, it will have implications for downstream components that expect to react to changes in the config object. Any component that needs to react to changes in the config object should be wrapped in anobserver()
call.We may also want to consider a different approach to the React root, i.e. a single root with portals for each chart, in which case it should be handled in this class and should not (hopefully) require child classes/components to change.