<abstract> new AppGraphStrategy(chart)
An abstract class to hold the specific algorighms to draw a chart.
These are different for point charts, line charts etc.
Supply the basic chart object as parameter.
Parameters:
Name | Type | Description |
---|---|---|
chart |
the basic chart object this strategy belongs to |
- Source:
Methods
-
<static> factory(chart, graphType)
-
Creates a new instance of a chart factory, the parameter graphType
specifies which subtype to createParameters:
Name Type Description chart
the basic chart object this graph strategy belongs to
graphType
the type of graph; supported is: "line" or "scatter"
- Source:
-
drawAnnotations(seriesesNode)
-
Draws the annotation saved with each data series
The method delegates back to the base charts drawAnnotation(...) function.Parameters:
Name Type Description seriesesNode
the DOM node where all the data serieses are attached
with their respective "annotation" property via d3's data(...) function.- Source:
-
drawMarkers(seriesesNode, accessor)
-
method for drawing a number of markers to the chart. A marker is a
highlight of a datapoint on the graph canvas with a label of coordinates.
The method delegates back to the base charts drawMarkers(...) function.Parameters:
Name Type Description seriesesNode
the DOM node where all the data serieses are attached
with their respective "marker" property via d3's data(...) function.accessor
accessor function to apply to the marker values in order
to extract coordinate values to search for close datapoints with
AppGraphStrategy.prototype.getNearest(...).- Source:
-
<abstract> drawSerieses(seriesNode)
-
Draws all the serieses data points. Should be overriden by specific
AppGraphStrategy subclass but should be called from subclass, because
sets up some event listenersParameters:
Name Type Description seriesNode
the DOM node where all the data serieses are attached
with their respective datapoints in the "values" property.- Source:
-
drawStickers(seriesesNode)
-
Draws the stickers saved with each data series
The method delegates back to the base charts drawStickers(...) function.Parameters:
Name Type Description seriesesNode
the DOM node where all the data serieses are attached
with their respective "stickers" property via d3's data(...) function.- Source:
-
getNearest(seriesValues, x, accessor)
-
from a series of values in the chart, gets the point which is closest
to some coordinate "x". how to access the coordinate in the series of
values supplied to the function is specified by an additional accessor
function that is applied to each value of the series.Parameters:
Name Type Description seriesValues
an array of values representing the series to analyze
x
the value to find the closest point to
accessor
the accessor function to apply to each seriesValue to get
the equivalent of "x"- Source: