TimeWheelChart Class
Advanced Chart: TimeWheelChart
Inherits from BasicBarChart redefining the drawing methods.
Data is represented as bars drawn around a time wheel.
It is possible to choose between having only a fixed number of values accepted,
or if a certain number of the oldest values should be removed when the
chart is full.
Item Index
Methods
- __canAppendData__
- __clearDrawing__
- __clearHorizontalAxe__
- __clearVerticalAxe__
- __decodeCSSMultivalueString__
- __drawHorizontalAxe__
- __drawHorizontalAxeTitle__
- __drawNewData__
- __drawVerticalAxe__
- __drawVerticalAxeTitle__
- __encodeCSSMultivalueString__
- __formatValue__
- __getBarOpacity__
- __getChartAreaHeight__
- __getChartAreaWidth__
- __getDatasetLength__
- __getHeight__
- __getWidth__
- __init__
- __initAxes__
- __initChart__
- __initData__
- __makeLabel__
- __moveWheelCenter__
- __onClearData__
- __redrawAll__
- __redrawInnerBackground__
- __redrawInnerBorder__
- __redrawOuterBackground__
- __redrawOuterBorder__
- __refreshDrawing__
- __selectData__
- __selectLabels__
- __timeLabelsVisible__
- __updateAxes__
- __updateBackground__
- __updateDrawing__
- __updateWheelDrawing__
- addLegend
- appendData
- areLabelsVisible
- BasicBarChart
- clearData
- destroy
- FixedWidthBarChart
- getAxesHeight
- getAxesWidth
- getBarsFillColor
- getBarsStrokeColor
- getBarWidth
- getFillColor deprecated
- getInnerBackgroundColor
- getInnerBorder
- getLabelColor
- getLabelsSize
- getOuterBackgroundColor
- getOuterBorder
- getStrokeColor deprecated
- removeHorizontalAxe
- removeVerticalAxe
- setAbbreviatedLabel
- setBarsFillColor
- setBarsStrokeColor
- setBarWidth
- setExtendedLabel
- setFillColor deprecated
- setFixedDataLengthMode
- setFormatValueFunction
- setGlobalScaling
- setHeight
- setHorizontalAxe deprecated
- setInnerBackgroundColor
- setInnerBorder
- setLabelColor
- setLabelSize
- setLocalScaling
- setOuterBackgroundColor
- setOuterBorder
- setPosition
- setShifitingDataMode
- setStrokeColor deprecated
- setTimeWheelForeColor
- setTimeWheelLabelsSize
- setTitle
- setVerticalAxe deprecated
- setWheelCenter
- setWidth
- TimeWheelChart
- toggleLabels
Properties
- __abbreviatedLabels__
- __axeBottom__
- __axeLeft__
- __axeRight__
- __axeTop__
- __barHeight__
- __barsFillColors__
- __barsStrokeColors__
- __barWidth__
- __chartArea__
- __cx__
- __cy__
- __data__
- __dataCounter__
- __dataDim__
- __divElement__
- __horizontalAxe__
- __innerBackgroundColor__
- __innerBorder__
- __labelColors__
- __labelsSize__
- __labelsVisible__
- __legend__
- __margins__
- __maxVals__
- __outerBackgroundColor__
- __outerBorder__
- __parent__
- __r__
- __scaleGlobally__
- __startTime__
- __startTime__
- __startTime__
- __svgElement__
- __tickLength__
- __ticks__
- __tickStep__
- __ticksToRemoveOnFullQueue__
- __timeLabels__
- __verticalAxe__
- __wheel__
- __xScale__
- __yScale__
- BAR_TEXT_MARGIN
- TICK_LINES_LENGTH
Methods
__canAppendData__
()
protected
WARNING: This function SHOULD be overriden in any class inheriting from the base class
in order to handle differents needs.
See base class for method signature and details.
__clearDrawing__
-
dataSet
-
labelsSet
Removes the svg objects related to the data cleared by the caller (clearData).
Parameters:
-
dataSet
Object[Mandatory] List of drawing objects (default: rects) representing data
-
labelsSet
Object[Mandatory] List of labels related to data removed
Returns:
__clearHorizontalAxe__
()
Undefined
protected
Clear all the drawings related to the horizontal axe.
Returns:
__clearVerticalAxe__
()
Undefined
protected
Clear all the drawings related to the vertical axe.
Returns:
__decodeCSSMultivalueString__
-
str
-
defaultValue
Parameters:
-
str
String[Mandatory] A string representing a CSS property with 4 possible subfields, as for margins or border-width: top, right, bottom and left.
Unless undefinedOnMiss is passed and it's truthy, the format of the string is the same as for CSS margin; it can therefore be one of the following: <ul> <li>""<br>No margin is set</li> <li>"top-bottom-right-left;"<br>All 4 subfields are set to the same value</li> <li>"top-bottom right-left;"<br>Top and bottom and right and left subfields have the same value</li> <li>"top right-left bottom;"<br>right and left subfield are set to the same value</li> <li>"top right bottom left;"<br>All 4 subfields are set separately</li> </ul>
-
defaultValue
Boolean[Optional] If it is not passed or it's false, the standard CSS format specification for multivalue string attributes will be used, as described above. Otherwise, if less than 4 values are provided in the string, they are assigned to subfields in the order top, right, bottom, left, while for the fields for whom a value isn't explicitely inserted, a defaultValue is used.
Returns:
__drawHorizontalAxe__
()
Undefined
protected
Draws the horizontal axe.
Returns:
__drawHorizontalAxeTitle__
-
axe
-
width
-
x
-
y
Draws the horizontal axe's title.
Parameters:
-
axe
Object[Mandatory] The object storing horizontal axe's properties.
-
width
Number[Mandatory] The width of the title label (tipically the same width as the axe).
-
x
Number[Mandatory] The x coordinate for the title label.
-
y
Number[Mandatory] The y coordinate for the title label.
Returns:
__drawNewData__
()
protected
WARNING: if you inherit from this class you might want to override both
this method and updateDrawing in order to obtain a custom chart.
See base class for method signature and details.
__drawVerticalAxe__
()
Undefined
protected
Draws the vertical axe.
Returns:
__drawVerticalAxeTitle__
-
axe
-
height
-
x
-
y
-
textAngle
-
textX
-
textPivot
Draws the vertical axe's title.
Parameters:
-
axe
Object[Mandatory] The object storing vertical axe's properties.
-
height
Number[Mandatory] The height of the title label (tipically the same height as the axe).
-
x
Number[Mandatory] The x coordinate for the title label.
-
y
Number[Mandatory] The y coordinate for the title label.
-
textAngle
Number[Mandatory] The textAngle for the rotation of the title label.
It can be + or - 90 degrees: together with x, y, textX and textPivot parameters, this allows to reuse this method for both left and right axes. -
textX
Number[Mandatory] Internally computed.
X position of the axe's title. -
textPivot
Number[Mandatory] Internally computed.
X position of the pivot point around whom the axe title has to be rotated.
Returns:
__encodeCSSMultivalueString__
-
obj
Parameters:
-
obj
Object[Mandatory] An object storing the values for the property.
Fields top, right, bottom, left are checked in order: as soon as one is missing, no more data will be added to the string
Returns:
__formatValue__
-
value
Checks that the value passed corresponds to the data format allowed for the current chart; This function can be overriden in any class inheriting from the base class in order to handle differents data formats (i.e. Objects or JSON).
Parameters:
-
value
Array | Object[Mandatory] The value to be tested;
Returns:
- An array with properly formatted values, each of whom converted to float <=> value is correctly validated
- null Otherwise
__getBarOpacity__
-
val
Computes and return the suggested value for the opacity of the bar drawn to represent a certain value.
Parameters:
-
val
Number[Mandatory] The value to be represented;
Accepts only normalized values (scaled between 0 and 1).
INVARIANT: to avoid defensive programming, it is assumed 0 <= val <=1
Returns:
__getChartAreaHeight__
()
Number
protected
Return the height of the drawing area for the chart.
Returns:
__getChartAreaWidth__
()
Number
protected
Return the width of the drawing area for the chart.
Returns:
__getDatasetLength__
()
Number
protected
Utility function to take account of the number of points currently added to the chart
Returns:
__getHeight__
()
Number
protected
Return the height of the drawing area for the chart.
Returns:
__getWidth__
()
Number
protected
Return the width of the drawing area for the chart.
Returns:
__init__
-
chart
-
width
-
height
-
wheelRadius
Inits the chart;
Parameters:
-
chart
Object[Mandatory] The chart that need initialization;
-
width
Number[Mandatory] Chart's width;
-
height
Number[Mandatory] Chart's height;
-
wheelRadius
Number[Mandatory]
Wheel inner radius;
Returns:
__initAxes__
-
width
-
height
Inits the 4 axes surrounding the chart main area according to the specific chart type.
WARNING: This method SHOULD be overridden in any inheriting class.
This method sets only those properties of the four axes that are peculiar to this chart
and that can be set:
- For top and bottom axes, only height can be set (their width is the same as the svg containing element)
- For left and right axes, only width can be set (their height is the same as the main chart area)
Parameters:
-
width
Number[Mandatory] The desired width for the chart (can't be changed later)
Can be any value that is or can be converted to a positive integer. -
height
Number[Mandatory] The desired height for the chart (can't be changed later)
Can be any value that is or can be converted to a positive integer.
Returns:
__initChart__
-
chart
-
width
-
height
-
[margins]
Inits the chart DIV and SVG container, setting width and height, if they are passed as arguments;
Parameters:
-
chart
Object[Mandatory] The chart object that needs initialization;
-
width
Number[Mandatory] The desired width for the chart; If passed, MUST be a positive integer, or a value that can be converted to a positive integer
-
height
Number[Mandatory] The desired height for the chart; If passed, MUST be a positive integer, or a value that can be converted to a positive integer
-
[margins]
String optional[Optional] A String of 0 to 4 comma-separated valued that specifies the 4 margins of the chart.
Omitted margins will get the default margin for this class.
Returns:
__initData__
-
basicCharObj
-
[dataDim=1]
Performs all the settings related to the data handling area of the chart;
Parameters:
-
basicCharObj
Object[Mandatory] The chart object to init;
-
[dataDim=1]
Number optional[Optional] The dimension of the data space, i.e. the number of subvalues for each data entry;
Can take any value that is or can be converted to an integer between 1 and MAXSPACEDIMENSION.
Returns:
__makeLabel__
-
val
-
[index=0]
-
[forceAbbreviate=false]
Converts an input number to
Parameters:
-
val
Number[Mandatory] The value that must be used in the label.
-
[index=0]
Number optional[Optional] The index of the subcomponent of the data.
-
[forceAbbreviate=false]
Boolean optional[Optional] Should the label be coercefully abbreviated?
Returns:
__moveWheelCenter__
-
cx
-
cy
When the center of the time wheel is moved, it takes care of all the updates needed for the chart
Parameters:
-
cx
Number[Mandatory] x coordinate of the new center;
-
cy
Number[Mandatory] y coordinate of the new center;
Returns:
__onClearData__
()
protected
[Protected method, not supposed to be used by consumers]
WARNING: Inherited objects MIGHT NEED to override this function
See base class for method signature and details.
__redrawAll__
()
Undefined
protected
Redraws completely the whole chart, updating all the non-fixed attributes of the drawings.
Returns:
__redrawInnerBackground__
()
Undefined
protected
Properly redraws the background of the main chart area
WARNING: if you inherit from this class you might want to override
this method to reflect its expected behaviour.
Returns:
__redrawInnerBorder__
-
[border=__innerBorder__]
Properly redraws the border of the inner chart area.
WARNING: if you inherit from this class you might want to override
this method to reflect its expected behaviour.
Parameters:
-
[border=__innerBorder__]
Object optional[Optional] An object summarizing all the border properties:
- fill: The color of the border;
- width: The width of the border line, in pixels;
- dash: The dash pattern of the line
Returns:
__redrawOuterBackground__
()
Undefined
protected
Properly redraws the background of the outer chart area
WARNING: if you inherit from this class you might want to override
this method to reflect its expected behaviour.
Returns:
__redrawOuterBorder__
-
[border=__outerBorder__]
Properly redraws the border of the outer chart area.
WARNING: if you inherit from this class you might want to override
this method to reflect its expected behaviour.
Parameters:
-
[border=__outerBorder__]
Object optional[Optional] An object summarizing all the border properties:
- fill: The color of the border;
- width: The width of the border line, in pixels;
- dash: The dash pattern of the line
Returns:
__refreshDrawing__
()
protected
Called by redrawAll() to redraw all the data-related drawings, once for
every data subcomponent.
The difference with updateDrawing is that the latter is incremental with respect to
drawNewData and updates only the properties used to provide animations of the drawing,
while this method redraws from scratch the data.
WARNING: if you inherit from this class you might want to override both
this method following updateDrawing behaviour in order to obtain a custom chart.
__selectData__
-
data
-
index
-
[n]
Returns the list of the svg elements used to represent data subcomponents
with the required index.
I.e.: if data space is 3-dimensional (i.e. every point has 3 components)
selectData(data, 2) would select the svg elements representing
the 2nd component of every point in data
Parameters:
-
data
Array[Mandatory] The dataset on which selection should be applied
-
index
Number[Mandatory] The index of the required component
INVARIANT: to avoid defensive programming, it is assumed 0 <= index < this.dataDim -
[n]
Number optional[Optional] The maximum number of elements to return;
Returns:
__selectLabels__
-
data
-
index
-
[n]
Returns the list of the svg elements used to draw the labels of
subcomponents of data with the required index.
I.e.: if data space is 3-dimensional (i.e. every point has 3 components)
selectLabels(data, 3) would select the svg elements representing
the labels of the 3nd component of every point in data
Parameters:
-
data
Array[Mandatory] The dataset on which selection should be applied;
-
index
Number[Mandatory] The index of the required component;
INVARIANT: to avoid defensive programming, it is assumed 0 <= index < this.dataDim -
[n]
Number optional[Optional] The maximum number of elements to return;
Returns:
__timeLabelsVisible__
()
Boolean
protected
Checks whether or not the labels showing time references on the wheel should be drawn
Returns:
__updateAxes__
-
yScale
Called by appendData() to update the labels of the vertical axe
when vertical scale changes;
WARNING: if you inherit from this class you might want to override
this method as well as drawNewData and updateDrawing
in order to obtain a custom chart.
Parameters:
-
yScale
Object[Mandatory] D3 scale object for Y axis;
Returns:
__updateBackground__
()
Undefined
protected
Called by drawNewData() to redraw the background properly;
WARNING: if you inherit from this class you might want to override
this method as well as drawNewData and updateDrawing
in order to obtain a custom chart.
Returns:
__updateDrawing__
()
protected
WARNING: if you inherit from this class you might want to override both
this method and drawNewData in order to obtain a custom chart.
See base class for method signature and details.
__updateWheelDrawing__
()
Undefined
protected
Updates the drawing of the static elements of the wheel
WARNING: Inherited objects MIGHT NEED to override this function
Returns:
addLegend
-
labels
Insert new data into the chart, at runtime;
Parameters:
-
labels
Array[Mandatory] An array containing exactly one label for each component of the data space.
A new legend object will be created and attached to the chart, and then for every subcomponent [label] a new item will be added to the legend.
Returns:
appendData
-
newDataArray
Insert new data into the chart, at runtime;
Parameters:
-
newDataArray
Array[Mandatory] An array containing the next values that needs to be drawn in the chart;
Each array element, in order to be added to the chart, must be compliant with the data format defined by the function formatData (which can itself be set at runtime, and by default accepts arrays of dataDim integers, neglecting to render the negative ones).
Returns:
areLabelsVisible
-
[index=0]
Checks if labels for the index-th dimension are visible
Parameters:
-
[index=0]
Number optional[Optional] For multi-dimensional data spaces, specifies which component is going to be affected;
Returns:
BasicBarChart
-
width
-
height
-
[chartMargins=""]
-
[dataDim=1]
-
[parent=body]
Parameters:
-
width
Number[Mandatory] The desired width for the chart (can't be changed later)
Can be any value that is or can be converted to a positive integer. -
height
Number[Mandatory] The desired height for the chart (can't be changed later)
Can be any value that is or can be converted to a positive integer. -
[chartMargins=""]
String optional[Optional] A String of 0 to 4 space-separated values that specifies the 4 margins of the chart.
The string should respect the following format: "top right bottom left;" (notice the trailing semicolon)
If less then 4 values are passed, only the covered subfield will be assigned using the input string, while the remaining ones will take a default value specified as an inner attribute of the class. -
[dataDim=1]
Number optional[Optional] The dimension of the data space, i.e. the number of subvalues for each data entry
Can be any value that is or can be converted to an integer between 1 and MAXSPACEDIMENSION. -
[parent=body]
Object optional[Optional] The DOM element to which the diagram should be appended as a child
Returns:
clearData
-
[n]
Remove all the data, or part of it, from the chart;
Parameters:
-
[n]
Number optional[Optional, For internal use only] The number of elements to remove from the beginning of the data array, i.e. how many of the oldest values should be removed from the chart;
Returns:
destroy
()
Null
Object's destructor: helps garbage collector freeing memory, and removes chart DOM elements.
WARNING: calling destroy on an object will force any further reference
to its attributes / methods to throw exceptions.
NOTE: This function should be override by any class inheriting from this chart.
In order to properly work, any overriding destroyer should:
- Free any array specific to the object on which is called;
- Remove any event listener on chart objects;
- Call super object's destroy method.
Returns:
FixedWidthBarChart
-
ticks
-
startingPoint
-
width
-
height
-
[chartMargins=""]
-
[dataDim=1]
-
[parent=body]
FixedWidthBarChart (pseudo)Constructor
Parameters:
-
ticks
Number[Mandatory] The number of values that can be drawn at the same time (can't be changed later)
Can be any value that is or can be converted to a positive integer. -
startingPoint
Number[Mandatory, but not used at the moment: inserted for future back-compatibility]
The reference for the label of the first point.
Should be an incrementable value; -
width
Number[Mandatory] The desired width for the chart (can't be changed later)
Can be any value that is or can be converted to a positive integer. -
height
Number[Mandatory] The desired height for the chart (can't be changed later)
Can be any value that is or can be converted to a positive integer. -
[chartMargins=""]
String optional[Optional] A String of 0 to 4 space-separated values that specifies the 4 margins of the chart.
The string should respect the following format: "top right bottom left;" (notice the trailing semicolon)
If less then 4 values are passed, only the covered subfield will be assigned using the input string, while the remaining ones will take a default value specified as an inner attribute of the class. -
[dataDim=1]
Number optional[Optional] The dimension of the data space, i.e. the number of subvalues for each data entry
Can be any value that is or can be converted to an integer between 1 and MAXSPACEDIMENSION. -
[parent=body]
Object optional[Optional] The DOM element to which the diagram should be appended as a child
Returns:
getAxesHeight
()
Array
Returns the height of each of the four axe areas surrounding the chart.
Returns:
getAxesWidth
()
Array
Returns the width of each of the four axe areas surrounding the chart.
Returns:
getBarsFillColor
-
[index=0]
Gets the fill color used to draw the index-th component of the data space.
Parameters:
-
[index=0]
Number optional[Optional] For multi-dimensional data spaces, specifies which component is going to be selected;
Returns:
getBarsStrokeColor
-
[index=0]
Gets the stroke color used to draw the index-th component of the data space.
Parameters:
-
[index=0]
Number optional[Optional] For multi-dimensional data spaces, specifies which component is going to be selected;
Returns:
getBarWidth
()
Number
Returns current bars' width. The overridden version takes a parameter, but this method doesn't need it because barWidth is fixed for this chart.
Returns:
getFillColor
()
deprecated
Use getBarsFillColor instead.
getInnerBackgroundColor
()
String | Object
Returns current color for background
Returns:
getInnerBorder
()
Object
Returns the current border settings for the main chart area.
Returns:
getLabelColor
-
[index=0]
Gets the fill color used for the labels attached to the index-th component of the data space.
Parameters:
-
[index=0]
Number optional[Optional] For multi-dimensional data spaces, specifies which component is going to be selected;
Returns:
getLabelsSize
-
[index=0]
Gets the size used for the labels attached to the index-th component of the data space.
Parameters:
-
[index=0]
Number optional[Optional] For multi-dimensional data spaces, specifies which component is going to be selected;
Returns:
getOuterBackgroundColor
()
String | Object
Returns current color for background
Returns:
getOuterBorder
()
Object
Returns the current border settings for the outer chart area.
Returns:
getStrokeColor
()
deprecated
Use getBarsStrokeColor instead.
removeHorizontalAxe
()
Object
chainable
Removes the horizontal axe object and all related drawings from this chart.
Returns:
removeVerticalAxe
()
Object
chainable
Removes the vertical axe object and all related drawings from this chart.
Returns:
setAbbreviatedLabel
-
[index=0]
Displays abbreviated text for bars' label.
F.i.: 1.1M instead of 1,123,543 or 4.3K instead of 4,356
Parameters:
-
[index=0]
Number optional[Optional] For multi-dimensional data spaces, specifies which component is going to be selected;
Returns:
setBarsFillColor
-
{String|Object]
-
[index=0]
Sets the fill color used to draw the index-th component of the data space.
Parameters:
-
{String|Object]
Objectcolor [Mandatory] The new fill color for the selected component's;
-
[index=0]
Number optional[Optional] For multi-dimensional data spaces, specifies which component is going to be selected;
Returns:
setBarsStrokeColor
-
color
-
[index=0]
Sets the stroke color used to draw the index-th component of the data space.
Parameters:
-
color
String[Mandatory] The new stroke color for the selected component's;
-
[index=0]
Number optional[Optional] For multi-dimensional data spaces, specifies which component is going to be selected;
Returns:
setBarWidth
-
barWidth
Sets the width of this chart's bars.
Parameters:
-
barWidth
Number[Mandatory] The new bar width to be set;
MUST be a positive number or its base 10 string representation.
Returns:
setExtendedLabel
-
[index=0]
Displays extended text for bars' label.
Parameters:
-
[index=0]
Number optional[Optional] For multi-dimensional data spaces, specifies which component is going to be selected;
Returns:
setFillColor
()
deprecated
Use setBarsFillColor instead.
setFixedDataLengthMode
()
Object
chainable
Sets fixed data length mode.
When ticks data points have already been plotted,
new plots would override previous ones.
Two solutions are made available:
- By default, new data is rejected, generating a full stack exception;
- A certain number of the oldest data points can be purged off the chart, counter-clockwise rotating the data;
This function sets the first option.
Returns:
setFormatValueFunction
-
formaValueFunction
Change the data formatting function, allowing to pass a custom handler to cope with JSON or other data formats.
Parameters:
-
formaValueFunction
Function[Mandatory] The new data formatting/parsing function;
Returns:
setGlobalScaling
()
Object
chainable
Sets scaling to global
When data space has a dimension greater than 1 (i.e. when each data value has more than 1 component)
these charts support either global scaling (relative to the whole dataset)
or local scaling (relative to value of the same component) of each subcomponent.
Returns:
setHeight
-
height
Sets the height of the chart bounding box.
Parameters:
-
height
Number[Mandatory] The new height of the chart;
Only positive Integers and values that can be converted to positive integers are accepted.
Returns:
setHorizontalAxe
()
Exception
deprecated
protected
Returns:
setInnerBackgroundColor
-
bgColor
Changes the background color
Parameters:
-
bgColor
String | Object[Mandatory] The new color for background;
Returns:
setInnerBorder
-
fill
-
[width]
-
[dash]
Changes the border of the main chart area.
Parameters:
-
fill
String | Object[Mandatory] The new color for the border, or "none" if it has to be removed;
-
[width]
Number optional[Mandatory] The width of the border line, in pixels;
-
[dash]
String optional[Mandatory] The dash pattern for the border;
The format for the dash string parameter allows to specify n couples of positive integers "#line1 #space1 #line2 #space2 ... #linen #spacen" where each #line and #space represents the number of pixels in the pattern for lines and spaces segments respectively.
Returns:
setLabelColor
-
color
-
[index=0]
Sets the fill color used for the labels attached to the index-th component of the data space.
Parameters:
-
color
String[Mandatory] The new color for the selected component's labels;
-
[index=0]
Number optional[Optional] For multi-dimensional data spaces, specifies which component is going to be selected;
Returns:
setLabelSize
-
size
-
[index=0]
Sets the size used for the labels attached to the index-th component of the data space.
Parameters:
-
size
Number[Mandatory] The new size for the selected component's labels; Must be a positive integer, or a value that can be converted to a positive integer;
-
[index=0]
Number optional[Optional] For multi-dimensional data spaces, specifies which component is going to be selected;
Returns:
setLocalScaling
()
Object
chainable
Sets scaling to local
When data space has a dimension greater than 1 (i.e. when each data value has more than 1 component)
these charts support either global scaling (relative to the whole dataset)
or local scaling (relative to value of the same component) of each subcomponent.
Returns:
setOuterBackgroundColor
-
bgColor
Changes the background color of the outer area of the chart.
Parameters:
-
bgColor
String | Object[Mandatory] The new color for background of the outer area;
Returns:
setOuterBorder
-
fill
-
[width]
-
[dash]
Changes the border of the outer chart area.
Parameters:
-
fill
String | Object[Mandatory] The new color for the border, or "none" if it has to be removed;
-
[width]
Number optional[Mandatory] The width of the border line, in pixels;
-
[dash]
String optional[Mandatory] The dash pattern for the border;
The format for the dash string parameter allows to specify n couples of positive integers "#line1 #space1 #line2 #space2 ... #linen #spacen" where each #line and #space represents the number of pixels in the pattern for lines and spaces segments respectively.
Returns:
setPosition
-
left
-
top
Sets the position of the chart in the page. Position is assumed to be absolute.
Parameters:
-
left
Number[Mandatory] The horizontal position of the chart bounding box;
-
top
Number[Mandatory] The vertical position of the chart bounding box;
Returns:
setShifitingDataMode
-
ticksToRemove
Sets data shift mode.
When ticks data points have already been plotted,
new plots would override previous ones.
Two solutions are made available:
- By default, new data is rejected, generating a full stack exception;
- A certain number of the oldest data points can be purged off the chart, counter-clockwise rotating the data;
This function sets the second option.
Parameters:
-
ticksToRemove
Number[Mandatory] How much data to remove on full chart;
Returns:
setStrokeColor
()
deprecated
Use setBarsStrokeColor instead.
setTimeWheelForeColor
-
color
Sets the color used for the static part of the wheel's drawing, i.e. for labels and lines representing time ticks of the time wheel.
Parameters:
-
color
String | Object[Mandatory] The new forecolor for the wheel;
Returns:
setTimeWheelLabelsSize
-
size
Sets the size of the labels used for the wheel.
Parameters:
-
size
Number[Mandatory] The new size for the labels (must be an integer gt zero);
Returns:
setTitle
-
title
-
[size=DEFAULT
-
[color=black]
-
[left=centered]
-
[top=0]
Sets the title for the chart, including all its attributes.
Parameters:
-
title
String[Mandatory] The new title for the chart;
-
[size=DEFAULT
NumberTITLE SIZE] [Optional] The size of the new title;
Only positive Integers and values that can be converted to positive integers are accepted. -
[color=black]
String optional[Optional] The color of the new title;
-
[left=centered]
Number optional[Optional] The horizontal position of the title, relative to the chart; the text will be centered around this point
Only positive Integers and values that can be converted to positive integers are accepted. -
[top=0]
Number optional[Optional] The vertical position of the title, relative to the chart;
Only positive Integers and values that can be converted to positive integers are accepted.
Returns:
setVerticalAxe
()
Exception
deprecated
protected
Returns:
setWheelCenter
-
cx
-
cy
Sets the position of the center of the wheel. If it is valid and it is different from the current position, the drawing is moved to the new position
Parameters:
-
cx
Number[Mandatory] x coordinate of the new center;
Only non negative integers or values that can be converted to non negative integers are accepted; -
cy
Number[Mandatory] y coordinate of the new center;
Only non negative integers or values that can be converted to non negative integers are accepted;
Returns:
setWidth
-
width
Sets the width of the chart bounding box.
Parameters:
-
width
Number[Mandatory] The new width of the chart;
Only positive integers and values that can be converted to positive Integers are accepted.
Returns:
TimeWheelChart
-
ticks
-
startTime
-
width
-
height
-
[chartMargins=""]
-
[dataDim=1]
-
[parent=body]
TimeWheelChart (pseudo)Constructor.
Parameters:
-
ticks
Number[Mandatory] The number of values that can be drawn at the same time (can't be changed later)
Can be any value that is or can be converted to a positive integer. -
startTime
String[Mandatory] The reference for the label of the first point.
Should be an incrementable value. -
width
Number[Mandatory] The desired width for the chart (can't be changed later)
Can be any value that is or can be converted to a positive integer. -
height
Number[Mandatory] The desired height for the chart (can't be changed later)
Can be any value that is or can be converted to a positive integer. -
[chartMargins=""]
String optional[Optional] A String of 0 to 4 space-separated values that specifies the 4 margins of the chart.
The string should respect the following format: "top right bottom left;" (notice the trailing semicolon)
If less then 4 values are passed, only the covered subfield will be assigned using the input string, while the remaining ones will take a default value specified as an inner attribute of the class. -
[dataDim=1]
Number optional[Optional] The dimension of the data space, i.e. the number of subvalues for each data entry;
Can be any value that is or can be converted to an integer between 1 and MAXSPACEDIMENSION. -
[parent=body]
Object optional[Optional] The DOM element to which the diagram should be appended as a child
Returns:
toggleLabels
-
[index=0]
-
[visible]
Toggles the visibility of labels in the chart
Parameters:
-
[index=0]
Number optional[Optional] For multi-dimensional data spaces, specifies which component is going to be affected;
-
[visible]
Boolean optional[Optional] If specified overwrites toggle behaviour and set the visibility to visible.
Returns:
Properties
__abbreviatedLabels__
Array
protected
For each data subcomponent, states whether or not its label is abbreviated (as in, f.i., 1.1M instead of 1,123,456)
Default: [false]*
__axeBottom__
Object
protected
The svg element for the bottom axe area
__axeLeft__
Object
protected
The svg element for the left axe area
__axeRight__
Object
protected
The svg element for the right axe area
__axeTop__
Object
protected
The svg element for the top axe area
__barHeight__
Number
protected
Maximum height for each bar
CAN NOT be changed at runtime
__barsFillColors__
Array
protected
For each data subcomponent, stores the color to be used to fill its drawing component
__barsStrokeColors__
Array
protected
For each data subcomponent, stores the color to be used for the stroke of its drawing component
Default: ["black"]*
__barWidth__
Number
protected
Chart's bars' width, in pixel
Can be changed at runtime
Default: 8
__chartArea__
Object
protected
The svg element for the main chart area
__cx__
Number
protected
X coordinate of the center of the wheel Can be changed at runtime
Default: the horizontal center of the chart
__cy__
Number
protected
Y coordinate of the center of the wheel
Can be changed at runtime
Default: the vertical center of the chart
__data__
Array
protected
The array that will hold data, separately for each component Initially every component's array is set to []
__dataCounter__
Number
protected
Keeps track of how much data has been actually inserted into the chart from its creation (to synch the highlighted ticks).
Default: 0
__dataDim__
Number
protected
Dimension of the data space, i.e. number of subcomponents of each data "point"
__divElement__
Object
protected
The div element that will be a container to the chart's svg element
__horizontalAxe__
Object
protected
An object describing the X axe's properties, or null if
it isn't supposed to be drawn.
If assigned, the object must have the following fields:
- side - Can be either "top" or "bottom"
- svgElement - Can be either __axeBottom__ or __axeTop__
- notches - The number of notches to be shown (Must be a positive integer)
Default: null
__innerBackgroundColor__
String | Object
protected
Color of the background of the main chart area.
Default: DEFAULT_INNER_BACKGROUND
__innerBorder__
Object
protected
Border of the main chart area.
Default: DEFAULT_INNER_BORDER
__labelColors__
Array
protected
For each data subcomponent, stores the color to be used to draw its labels
Default: ["black"]*
__labelsSize__
Number
protected
For each data subcomponent, stores the size to be used for its label
Default: DEFAULT_LABEL_SIZE
__labelsVisible__
Array
protected
For each data subcomponent, states whether or not its label is visible
Default: [true]*
__legend__
Object
protected
Placeholder for a possible legend object, if the consumer decides to add a legend to the chart;
Default: null
__margins__
Object
protected
The four margins of the chart object;
__maxVals__
Number
protected
Array of maximum values for each component
(used to compute the vertical scale)
Default: [0]*
__outerBackgroundColor__
String | Object
protected
Color of the background of the outer area of the whole chart div.
Default: DEFAULT_OUTER_BACKGROUND
__outerBorder__
Object
protected
Color of the background of the outer area of the whole chart div.
Default: DEFAULT_OUTER_BORDER
__parent__
Object
protected
The parent object to whom the chart is added
__r__
Number
protected
Radius of the wheel
CAN NOT be changed at runtime
__scaleGlobally__
Boolean
protected
For data space with dimension gt 1, states if the different components should scale locally or globally
Default: true
__startTime__
String
protected
Label stating the time corresponding to the first tick;
__startTime__
String
protected
Size in points of the static labels showing time references on the wheel;
Default: data labels' size
__startTime__
String | Object
protected
Color used for the static part of the wheel
Default: "lightgrey"
__svgElement__
Object
protected
The chart's svg element
__tickLength__
Number
protected
Tick length, in minutes
Default: 1
__ticks__
Number
protected
Number of different values that can be drawn at the same time in this chart
__tickStep__
Number
protected
The angle between two consecutive ticks
CAN NOT be changed at runtime
__ticksToRemoveOnFullQueue__
Number
protected
When ticks data points have already been plotted, new plots would override previous ones. Two solutions are made available: 1) By default, new data is rejected, generating a full stack exception; 2) A certain number of the oldest data points can be purged off the chart, counter-clockwise rotating the data.
Default: 0
__timeLabels__
Array
protected
List of labels for wheel's time references
__verticalAxe__
Object
protected
An object describing the Y axe's properties, or null if
it isn't supposed to be drawn.
If assigned, the object must have the following fields:
- side - Can be either "left" or "right"
- svgElement - Can be either __axeLeft__ or __axeRight__
- notches - The number of notches to be shown (Must be a positive integer)
Default: null
__wheel__
Object
protected
The actual svg object for the static part of the wheel
__xScale__
Object
protected
Scale object for the horizontal axis of the chart (common to all data subcomponents)
__yScale__
Array
protected
Scale objects for the vertical axis of the chart (array with one obj for each data subcomponents, so that each component can be scaled independently)
BAR_TEXT_MARGIN
Number
private
final
Margin between bars and their related labels;
Default: = 5
TICK_LINES_LENGTH
Number
private
final
Length of notch lines, in pixels;
Default: = 5