Class: LinearTimeStep

PD.SVG. LinearTimeStep

Defines an annual hourly data value chart.


new LinearTimeStep(config)

Creates a new annual hourly data value chart.

Parameters:
Name Type Description
config object

A configuration object.

Properties of config:
Name Type Description
svgId SVGElement | string

The SVG element to use, or the DOM identifier of an SVG element.

Author:
  • drajmarsh
Throws:

Throws an error if provided with an invalid svgId element or id.

Type
Error

Members


:number

id

A unique identifier for this chart.

This is useful if you have multiple charts and need to quickly differentiate them. The value of this identifier will unique across the current project or browser tab session.

Type
  • number

show

Shows or hides the chart based on given state.


:SVGElement

svgElem

The SVG element to render the chart to.

Type
  • SVGElement

Methods


autoScale( [fit])

Get/set whether or not to auto-fit the vertical scale.

Parameters:
Name Type Argument Description
fit boolean <optional>

When provided, this is the new auto-fit state for the chart.

Returns:

If a new auto-fit state is given, this object instance is returned to support method chaining. If no new auto-fit state is given, the current auto-fit state is returned.

Type
object | boolean

detailMode( [state])

Get/set interactive fine detail mode.

Parameters:
Name Type Argument Description
state boolean <optional>

When provided, use true to turn detailed mode on of false to turn it off.

Returns:

If a new boolean value is given, this object instance is returned to support method chaining. If no new boolean value is given, the current detail mode state is returned.

Type
boolean

getAxisList()

Retrieves the array of current chart axis.

Returns:

Returns an array of PD.SVG.ChartAxis objects.

Type
Array

getDataHeight()

Get the height of the actual chart data area.

Returns:

Returns the current chart data area height in pixels.

Type
number

getDataList()

Retrieves the array of current chart data lines.

Returns:

Returns an array of chart data objects.

Type
Array

getDataWidth()

Get the width of the actual chart data area.

Returns:

Returns the current chart data area width in pixels.

Type
number

getExportableText(inkscape_layers)

Converts the current SVG chart to text for exporting to a file.

This method adds an xml header and document type to the text as well as embedding styles.

Parameters:
Name Type Description
inkscape_layers boolean

Whether or not to convert id attributes to Inkscape layer data.

Returns:

Returns the SVG chart as a text string.

Type
string

height( [pixels])

Get/set the overall height of the chart, in pixels.

Parameters:
Name Type Argument Description
pixels number <optional>

When provided, this sets the new chart height in pixels. When not provided, this method gets the current chart height.

Returns:

If a new height is given, this object instance is returned to support method chaining. If no new height is given, the current chart height in pixels is returned.

Type
number

hideTooltip()

Hides the tooltip above the selected node if it is visible.

Returns:

Returns this chart instance to support method chaining.

Type
object

highlightDataLine(abbrev)

Fades in the highlighted line and fades out all others.

Parameters:
Name Type Description
abbrev string

The abbreviated name of the line to highlight.

Returns:

Returns this chart instance to support method chaining.

Type
object

paddingBottom( [pixels])

Get/set the inset on the bottom side of the chart.

Parameters:
Name Type Argument Description
pixels number <optional>

When provided, this sets the number of pixels the chart axis is indented from the parent container edge on the bottom side.

Returns:

Returns the current bottom padding in pixels.

Type
number

paddingLeft( [pixels])

Get/set the inset on the left side of the chart.

Parameters:
Name Type Argument Description
pixels number <optional>

When provided, this sets the number of pixels the chart axis is indented from the parent container edge on the left side.

Returns:

Returns the current left padding in pixels.

Type
number

paddingRight( [pixels])

Get/set the inset on the right side of the chart.

Parameters:
Name Type Argument Description
pixels number <optional>

When provided, this sets the number of pixels the chart axis is indented from the parent container edge on the right side.

Returns:

Returns the current right padding in pixels.

Type
number

paddingTop( [pixels])

Get/set the inset on the top side of the chart.

Parameters:
Name Type Argument Description
pixels number <optional>

When provided, this sets the number of pixels the chart axis is indented from the parent container edge on the top side.

Returns:

Returns the current top padding in pixels.

Type
number

refresh()

Regenerates the chart from scratch.

Returns:

Returns this chart instance to support method chaining.

Type
object

rescale( [instant])

Initiates a rescaling of the chart when it has changed size or shape.

The maximum frequency at which this method will actually rescale the chart is governed by the 'throttledRescale' property.

Parameters:
Name Type Argument Default Description
instant boolean <optional>
<nullable>
false

An optional flag to make the rescale immediate even if debounced, defaults to false.

Returns:

Returns this chart instance to support method chaining.

Type
object

set(config)

Sets one or more configuration values for the chart.

Parameters:
Name Type Description
config object

An object containing one or more configuration settings.

Returns:

Returns this chart instance to support method chaining.

Type
object

setDataLines(lines [, primary_units])

Sets the data to annual daily heat loads.

Parameters:
Name Type Argument Description
lines Array

An array line data to display.

primary_units string <optional>

The units to use for the primary axis.

Returns:

Returns this chart instance to support method chaining.

Type
object

setRange(start, end)

Sets the minimum and maximum values in the X axis.

Parameters:
Name Type Description
start number

The starting day of the year.

end number

The ending day of the year.

Returns:

Returns this chart instance to support method chaining.

Type
object

setTime(time)

Sets the current time of day, in decimal hours.

Parameters:
Name Type Description
time number

The time of the day, in decimal hours (0 to 24.0).

Returns:

Returns this chart instance to support method chaining.

Type
object

stackLines( [stack])

Get/set the setting for stacking or overlaying data lines.

The available stacking values are:

  • 0 - Overlay all data lines,
  • 1 - Stack data lines by unit type, and
  • 2 - Stack all data lines.
Parameters:
Name Type Argument Description
stack number <optional>

When provided, this is the new stack setting for the chart.

Returns:

If a new stack setting is given, this object instance is returned to support method chaining, otherwise the current stack setting is returned.

Type
object | number

subTitle( [subtitle])

Get/set the chart sub-title displayed in the header above the chart.

Parameters:
Name Type Argument Description
subtitle string <optional>

When provided, this is the new sub-title for the chart.

Returns:

If a new sub-title is given, this object instance is returned to support method chaining. If no new sub-title is given, the current chart sub-title is returned.

Type
string

throttledRescale( [ms])

Get/set the timer value for throttling calls to the 'rescale()' method.

This basically means that multiple calls to the 'rescale()' method that occur within the specified number of milliseconds will be amalgamated to a single call that occurs at the end of that period.

Parameters:
Name Type Argument Description
ms number <optional>

When provided, this is the throttling time, in milliseconds. Any value less than 5ms effectively turns off throttling. When not provided, this method gets the current throttling time, in milliseconds.

Returns:

If a new time is given, this object instance is returned to support method chaining. If no new time is given, the current throttling time in milliseconds is returned.

Type
number

title( [title])

Get/set the chart title displayed in the header above the chart.

Parameters:
Name Type Argument Description
title string <optional>

When provided, this is the new title for the chart.

Returns:

If a new title is given, this object instance is returned to support method chaining. If no new title is given, the current chart title is returned.

Type
string

titleAlign( [align])

Get/set the alignment of the title displayed in the header above the chart.

Parameters:
Name Type Argument Description
align string <optional>

When provided, this is the new title alignment for the chart. This can be either given as a string ()'left', 'center' or 'right') or as a percentage offset from the center of chart (-100 to 100). When given as a percentage, a negative value indicates an offset to the left whilst a positive value is an offset to the right.

Returns:

If a new alignment is given, this object instance is returned to support method chaining. If no new alignment is given, the current title alignment value is returned.

Type
string

units( [units])

Get/set the chart units displayed in the header above the chart.

Parameters:
Name Type Argument Description
units string <optional>

When provided, this is the new units for the chart.

Returns:

If new units are given, this object instance is returned to support method chaining. If no new units are given, the current chart units is returned.

Type
string

update()

Updates the axis scales in the chart.

NOTE: Only use this if the only change is an axis scale.

Returns:

Returns this chart instance to support method chaining.

Type
object

width( [pixels])

Get/set the overall width of the chart.

Parameters:
Name Type Argument Description
pixels number <optional>

When provided, this sets the new chart width in pixels. When not provided, this method gets the current chart width.

Returns:

If a new width is given, this object instance is returned to support method chaining. If no new width is given, the current chart width in pixels is returned.

Type
number