API Docs for:
Show:

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

Methods

__canAppendData__

() protected

Inherited from BasicBarChart but overwritten in dynamic_chart.js:4017

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
)
Undefined protected

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:

Undefined:

__clearHorizontalAxe__

() Undefined protected

Inherited from BasicBarChart: dynamic_chart.js:2373

Available since 0.2

Clear all the drawings related to the horizontal axe.

Returns:

Undefined:

__clearVerticalAxe__

() Undefined protected

Inherited from BasicBarChart: dynamic_chart.js:2531

Available since 0.2

Clear all the drawings related to the vertical axe.

Returns:

Undefined:

__decodeCSSMultivalueString__

(
  • str
  • defaultValue
)
Object protected

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:

Object: : An object with values for top, right, bottom and left subfields.

__drawHorizontalAxe__

() Undefined protected

Inherited from BasicBarChart: dynamic_chart.js:2443

Available since 0.2

Draws the horizontal axe.

Returns:

Undefined:

__drawHorizontalAxeTitle__

(
  • axe
  • width
  • x
  • y
)
Undefined protected

Inherited from BasicBarChart: dynamic_chart.js:2396

Available since 0.2

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:

Undefined:

__drawNewData__

() protected

Inherited from BasicBarChart but overwritten in dynamic_chart.js:5364

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

Inherited from BasicBarChart: dynamic_chart.js:2611

Available since 0.2

Draws the vertical axe.

Returns:

Undefined:

__drawVerticalAxeTitle__

(
  • axe
  • height
  • x
  • y
  • textAngle
  • textX
  • textPivot
)
Undefined protected

Inherited from BasicBarChart: dynamic_chart.js:2554

Available since 0.2

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:

Undefined:

__encodeCSSMultivalueString__

(
  • obj
)
String protected

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:

String: : A string with a proper representation of the property.

__formatValue__

(
  • value
)
Array protected

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:

Array:
  • An array with properly formatted values, each of whom converted to float <=> value is correctly validated
  • null Otherwise

__getBarOpacity__

(
  • val
)
Number protected

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:

Number: The opacity to apply to the value representation in the chart.

__getChartAreaHeight__

() Number protected

Return the height of the drawing area for the chart.

Returns:

Number: The height of the drawing area for the chart.

__getChartAreaWidth__

() Number protected

Return the width of the drawing area for the chart.

Returns:

Number: The width of the drawing area for the chart.

__getDatasetLength__

() Number protected

Utility function to take account of the number of points currently added to the chart

Returns:

Number: How many points are stored in the dataset right now.

__getHeight__

() Number protected

Return the height of the drawing area for the chart.

Returns:

Number: The total height of the chart.

__getWidth__

() Number protected

Return the width of the drawing area for the chart.

Returns:

Number: The total width of the chart.

__init__

(
  • chart
  • width
  • height
  • wheelRadius
)
Undefined private

Inherited from FixedWidthBarChart but overwritten in dynamic_chart.js:5702

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:

Undefined:

__initAxes__

(
  • width
  • height
)
Undefined protected

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:

Undefined:

__initChart__

(
  • chart
  • width
  • height
  • [margins]
)
Undefined private

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:

Undefined:

__initData__

(
  • basicCharObj
  • [dataDim=1]
)
Undefined private

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:

Undefined:

__makeLabel__

(
  • val
  • [index=0]
  • [forceAbbreviate=false]
)
String protected

Inherited from BasicBarChart: dynamic_chart.js:2724

Available since 0.2

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:

String: The properly formatted text for the label.

__moveWheelCenter__

(
  • cx
  • cy
)
Undefined protected

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:

Undefined:

__onClearData__

() protected

Inherited from BasicBarChart but overwritten in dynamic_chart.js:5529

[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

Inherited from BasicBarChart: dynamic_chart.js:1966

Available since 0.2

Redraws completely the whole chart, updating all the non-fixed attributes of the drawings.

Returns:

Undefined: Pseudo protected method called only internally, no need to return anything

__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:

Undefined:

__redrawInnerBorder__

(
  • [border=__innerBorder__]
)
Undefined protected

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
    By default, if border is omitted, the chart's innerBorder attribute is used.

Returns:

Undefined:

__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:

Undefined:

__redrawOuterBorder__

(
  • [border=__outerBorder__]
)
Undefined protected

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
    By default, if border is omitted, the chart's outerBorder attribute is used.

Returns:

Undefined:

__refreshDrawing__

() protected

Inherited from BasicBarChart but overwritten in dynamic_chart.js:5471

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]
)
Object protected

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:

Object: The proper set of d3 elements.

__selectLabels__

(
  • data
  • index
  • [n]
)
Object protected

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:

Object: The proper set of d3 elements.

__timeLabelsVisible__

() Boolean protected

Checks whether or not the labels showing time references on the wheel should be drawn

Returns:

Boolean: True <=> the time reference labels are visible.

__updateAxes__

(
  • yScale
)
Undefined protected chainable

Inherited from BasicBarChart but overwritten in dynamic_chart.js:5609

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:

Undefined:

__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:

Undefined:

__updateDrawing__

() protected

Inherited from BasicBarChart but overwritten in dynamic_chart.js:5425

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:

Undefined:

addLegend

(
  • labels
)
Object chainable

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:

Object: This chart object, to support method chaining;

appendData

(
  • newDataArray
)
Object chainable

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:

Object: This chart object, to support method chaining;

areLabelsVisible

(
  • [index=0]
)
Boolean

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:

Boolean: The visibility of the label

BasicBarChart

(
  • width
  • height
  • [chartMargins=""]
  • [dataDim=1]
  • [parent=body]
)
Object chainable

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:

Object: A new BasicBarChart object

clearData

(
  • [n]
)
Object chainable

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:

Object: This object, to allow for method chaining;

destroy

() Null

Inherited from BasicBarChart but overwritten in dynamic_chart.js:5663

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:

  1. Free any array specific to the object on which is called;
  2. Remove any event listener on chart objects;
  3. Call super object's destroy method.

Returns:

Null: to state that the object has been destroyed.

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:

: A new FixedWidthBarChart object

getAxesHeight

() Array

Returns the height of each of the four axe areas surrounding the chart.

Returns:

Array: An array with the height of the four axes in the following order: [top, right, bottom, left].

getAxesWidth

() Array

Returns the width of each of the four axe areas surrounding the chart.

Returns:

Array: An array with the width of the four axes in the following order: [top, right, bottom, left].

getBarsFillColor

(
  • [index=0]
)
String | Object chainable

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:

String | Object: The selected fill color.

getBarsStrokeColor

(
  • [index=0]
)
String

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:

String: The selected stroke color.

getBarWidth

() Number

Inherited from BasicBarChart but overwritten in dynamic_chart.js:3999

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:

Number: the value set for barWidth.

getFillColor

() deprecated

Use getBarsFillColor instead.

getInnerBackgroundColor

() String | Object

Returns current color for background

Returns:

String | Object: the value set for innerBackgroundColor

getInnerBorder

() Object

Returns the current border settings for the main chart area.

Returns:

Object: the value set for innerBackgroundColor

getLabelColor

(
  • [index=0]
)
String

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:

String: The selected label color.

getLabelsSize

(
  • [index=0]
)
Number

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:

Number: The selected size.

getOuterBackgroundColor

() String | Object

Returns current color for background

Returns:

String | Object: the value set for innerBackgroundColor

getOuterBorder

() Object

Returns the current border settings for the outer chart area.

Returns:

Object: the value set for innerBackgroundColor

getStrokeColor

() deprecated

Use getBarsStrokeColor instead.

removeHorizontalAxe

() Object chainable

Inherited from BasicBarChart: dynamic_chart.js:1752

Available since 0.2

Removes the horizontal axe object and all related drawings from this chart.

Returns:

Object: This chart object, to allow for method chaining.

removeVerticalAxe

() Object chainable

Inherited from BasicBarChart: dynamic_chart.js:1857

Available since 0.2

Removes the vertical axe object and all related drawings from this chart.

Returns:

Object: This chart object, to allow for method chaining.

setAbbreviatedLabel

(
  • [index=0]
)
Object chainable

Inherited from BasicBarChart: dynamic_chart.js:1582

Available since 0.2

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:

Object: This chart object, to allow for method chaining.

setBarsFillColor

(
  • {String|Object]
  • [index=0]
)
Object chainable

Sets the fill color used to draw the index-th component of the data space.

Parameters:

  • {String|Object] Object

    color [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:

Object: This chart object, to allow for method chaining.

setBarsStrokeColor

(
  • color
  • [index=0]
)
Object chainable

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:

Object: This chart object, to allow for method chaining.

setBarWidth

(
  • barWidth
)
Object chainable

Inherited from BasicBarChart but overwritten in dynamic_chart.js:5250

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:

Object: This object, to allow for method chaining;

setExtendedLabel

(
  • [index=0]
)
Object chainable

Inherited from BasicBarChart: dynamic_chart.js:1621

Available since 0.2

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:

Object: This chart object, to allow for method chaining.

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:

  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;


This function sets the first option.

Returns:

Object: This chart object, to allow for methd chaining.

setFormatValueFunction

(
  • formaValueFunction
)
Object chainable

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:

Object: This object, to allow for method chaining;

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:

Object: This chart object, to allow for method chaining.

setHeight

(
  • height
)
Object chainable

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:

Object: This chart object, to allow for method chaining.

setHorizontalAxe

() Exception deprecated protected

Inherited from BasicBarChart but overwritten in dynamic_chart.js:5633

Deprecated: Ortogonal axes can't be added for charts of this class.

Returns:

Exception: To make explicit the fact that this method isn't available for this class.

setInnerBackgroundColor

(
  • bgColor
)
Object chainable

Changes the background color

Parameters:

  • bgColor String | Object

    [Mandatory] The new color for background;

Returns:

Object: This chart object, to allow for method chaining.

setInnerBorder

(
  • fill
  • [width]
  • [dash]
)
Object chainable

Inherited from BasicBarChart: dynamic_chart.js:1486

Available since 0.2

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:

Object: This chart object, to allow for method chaining.

setLabelColor

(
  • color
  • [index=0]
)
Object chainable

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:

Object: This chart object, to allow for method chaining.

setLabelSize

(
  • size
  • [index=0]
)
Object chainable

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:

Object: This chart object, to allow for method chaining.

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:

Object: This chart object, to allow for method chaining.

setOuterBackgroundColor

(
  • bgColor
)
Object chainable

Inherited from BasicBarChart: dynamic_chart.js:1459

Available since 0.2

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:

Object: This chart object, to allow for method chaining.

setOuterBorder

(
  • fill
  • [width]
  • [dash]
)
Object chainable

Inherited from BasicBarChart: dynamic_chart.js:1535

Available since 0.2

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:

Object: This chart object, to allow for method chaining.

setPosition

(
  • left
  • top
)
Object chainable

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:

Object: This chart object, to allow for method chaining.

setShifitingDataMode

(
  • ticksToRemove
)
Object chainable

Sets data shift mode.

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;

This function sets the second option.

Parameters:

  • ticksToRemove Number

    [Mandatory] How much data to remove on full chart;

Returns:

Object: This object, to allow for method chaining;

setStrokeColor

() deprecated

Use setBarsStrokeColor instead.

setTimeWheelForeColor

(
  • color
)
Object chainable

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:

Object: This chart object, to allow for method chaining;

setTimeWheelLabelsSize

(
  • size
)
Object chainable

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:

Object: This chart object, to allow for method chaining;

setTitle

(
  • title
  • [size=DEFAULT
  • [color=black]
  • [left=centered]
  • [top=0]
)
Object chainable

Sets the title for the chart, including all its attributes.

Parameters:

  • title String

    [Mandatory] The new title for the chart;

  • [size=DEFAULT Number

    TITLE 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:

Object: This legend object, to allow for method chaining.

setVerticalAxe

() Exception deprecated protected

Inherited from BasicBarChart but overwritten in dynamic_chart.js:5648

Deprecated: Ortogonal axes can't be added for charts of this class.

Returns:

Exception: To make explicit the fact that this method isn't available for this class.

setWheelCenter

(
  • cx
  • cy
)
Object chainable

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:

Object: This chart object, to allow for method chaining;

setWidth

(
  • width
)
Object chainable

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:

Object: This chart object, to allow for method chaining.

TimeWheelChart

(
  • ticks
  • startTime
  • width
  • height
  • [chartMargins=""]
  • [dataDim=1]
  • [parent=body]
)
Object

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:

Object: A new TimeWheelChart object

toggleLabels

(
  • [index=0]
  • [visible]
)
Object chainable

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:

Object: This chart object, to allow for method chaining

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

Inherited from FixedWidthBarChart but overwritten in dynamic_chart.js:5721

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