Chart that is attached to a single Axis of a ChartXY.

It shows a compilation of all data from all Series that are attached to that Axis, and allows the user to configure the view of the attached Axis easily by interacting with a Band on the ZoomBandChart.

Created with createZoomBandChart.


const dashboard = lightningChart().Dashboard( {
numberOfColumns: 1,
numberOfRows: 4
} )

const chart = dashboard.createChartXY( {
columnIndex: 0,
columnSpan: 1,
rowIndex: 0,
rowSpan: 3
})

const zoomBandChart = dashboard.createZoomBandChart({
columnIndex: 0,
columnSpan: 1,
rowIndex: 3,
rowSpan: 1,
axis: chart.getDefaultAxisX()
})

const line = chart.addLineSeries()
createProgressiveTraceGenerator()
.setNumberOfPoints( 1000 )
.generate()
.toPromise()
.then( data => line.add( data ) )

Hierarchy

  • ZoomBandChart

Implements

Properties

attachedAxes: Axis[]

List of axes that are attached to the ZoomBandChart.

band: Band

The Band of the ZoomBandChart.

engine: PublicEngine

Public, safe interface of rendering engine.

Methods

  • Add a legendbox.

    Legendbox is a type of UI element, that floats inside the chart/component it is created inside. It can be freely moved around with user interactions, as well as positioned in application code.

    The purpose of legendbox is to describe the series and other visual components of the chart, by displaying their names and colors. Hovering over a series' legendbox entry will highlight that series, and clicking on the entry will toggle that series' visibility.

    Legendbox alignment:

    Alignment of legendbox can be selected by supplying one of the available LegendBoxBuilders to addLegendBox:

     // Default (vertical) LegendBox.
    const legendBox = ChartXY.addLegendBox()

    // Horizontal LegendBox.
    const horizontalLegendBox = ChartXY.addLegendBox(LegendBoxBuilders.HorizontalLegendBox)

    Custom Legendbox positioning:

    By default LegendBoxes are placed on the right side, or bottom of the chart (depending on alignment).

    A custom location can be configured with UIElement API:

    Position coordinate system is specified when creating legendbox.

    1. LegendBox with default positioning coordinate system.
     addLegendBox( LegendBoxBuilders.VerticalLegendBox )
    // Position = [0, 100] as percentages.
    .setPosition({ x: 50, y: 50 })
    1. Position in pixel coordinate system.
     addLegendBox( LegendBoxBuilders.VerticalLegendBox, chart.pixelScale )
    // Position = pixels.
    .setPosition({ x: 300, y: 100 })
    1. Position on Axes.
     addLegendBox( LegendBoxBuilders.VerticalLegendBox, { x: chartXY.getDefaultAxisX(), y: chartXY.getDefaultAxisY() } )
    // Position = Axis values.
    .setPosition({ x: 5, y: 5 })

    Returns

    LegendBox

    Parameters

    • Optional builder: UILegendBoxBuilder<InternalBackground>

      LegendBoxBuilder. If omitted, VerticalLegendBox will be selected. Use LegendBoxBuilders for selection.

    • Optional scale: UserScaleDefinition

      Optional parameter for altering the coordinate system used for positioning the LegendBox. Defaults to whole Chart in percentages [0, 100].

    Returns LegendBox<UIBackground>

  • Add a stand-alone UIElement using a builder.

    Returns

    Object that fulfills interfaces: UIElementType (typeparam) and UIElement

    Type Parameters

    Parameters

    • Optional uiElementBuilder: UIElementBuilder<UIElementType>
    • Optional scale: LinearScaleXY

      Optional custom scale to position UIElement on. Defaults to whole component in percentages [0, 100].

    Returns UIElementType & UIElement

  • Permanently destroy the component.

    To fully allow Garbage-Collection to free the resources used by the component, make sure to remove any references to the component and its children in application code.

    let chart = ...ChartXY()
    let axisX = chart.getDefaultAxisX()
    // Dispose Chart, and remove all references so that they can be garbage-collected.
    chart.dispose()
    chart = undefined
    axisX = undefined

    Returns

    Object itself for fluent interface

    Returns ZoomBandChart

  • Dispose a Series reference from the ZoomBandChart.

    This ensures that all resources that were previously allocated for this series instance are released for Garbage Collection.

    Returns

    Object itself.

    Parameters

    • series: ZoomBandChartSupportedSeries

      Series object.

    Returns ZoomBandChart

  • Get the X Axis of the ZoomBandChart.

    Returns

    Axis

    Returns Axis

  • Get the Y Axis of the ZoomBandChart.

    Returns

    Axis

    Returns Axis

  • Get minimum size of Panel. Depending on the type of class this value might be automatically computed to fit different elements.

    Returns

    Point minimum size or undefined if unimplemented

    Returns undefined | Point

  • Returns the Theme currently being used.

    Returns

    An object containing the Theme.

    Returns Theme

  • Get text of Chart title.

    Returns

    Chart title as a string.

    Returns string

  • Remove event listener from dispose event.

    Returns

    True if the listener is successfully removed and false if it is not found

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

  • Subscribe onDispose event. This event is triggered whenever the Zoom BandChart is disposed.

     // Example usage

    zoomBandChart.onDispose(() => {
    console.log('zoomBandChart was disposed')
    })

    zoomBandChart.dispose()

    Returns

    Token of subscription

    Parameters

    Returns Token

  • Capture rendered state in an image file. Prompts the browser to download the created file.

    NOTE: The download might be blocked by browser/plugins as harmful. To prevent this, only call the method in events tied to user-interactions. From mouse-event handlers, for example.

    Has two optional parameters which directly reference JavaScript API HTMLCanvasElement.toDataURL. For supported image formats, compression quality, Etc. refer to:

    https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL

    Example usage:

    // Download 'screenshot.png'
    saveToFile('screenshot')
    // Attempt download 'maybeNotSupported.bmp'
    saveToFile('maybeNotSupported', 'image/bmp')
    // Attempt download jpeg.file with specified compression quality
    saveToFile('fileName', 'image/jpeg', 0.50)

    Remarks

    If 'type' is not supported by browser, an Error will be thrown.

    Parameters

    • fileName: string

      Name of prompted download file as string. File extension shouldn't be included as it is automatically detected from 'type'-argument.

    • Optional type: string

      A DOMString indicating the image format. The default format type is image/png.

    • Optional encoderOptions: number

      A Number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp. If this argument is anything else, the default value for image quality is used. The default value is 0.92.

    Returns ZoomBandChart

  • Set padding around Chart in pixels.

    Returns

    Object itself for fluent interface

    Parameters

    • padding: number | Partial<Margin>

      Number with pixel margins for all sides or datastructure with individual pixel paddings for each side. Any side can be omitted, only passed values will be overridden.

    Returns ZoomBandChart

  • Set style of Series of ZoomBandChart.

    ZoomBandChart creates series automatically based on the Series attached to the ZoomBandCharts reference Axis, that is specified when it is created. This method lets the user specify a function that is called on each Series created by ZoomBandChart, allowing the full configuration of these Series.

    Parameters

    Returns ZoomBandChart

  • Set text of Chart title.

    Returns

    Object itself for fluent interface.

    Parameters

    • title: string

      Chart title as a string.

    Returns ZoomBandChart

  • Specifies Margins after chart title.

    This does not have an effect if title is hidden (empty FillStyle).

     // Example 1, specify complete margin for Title (four sides).
    ZoomBandChart.setTitleMargin({ left: 16, right: 16, top: 32, bottom: 8 })
     // Example 2, specify only single margin for Title.
    ZoomBandChart.setTitleMargin({ right: 64 })
     // Example 2, specify margins for all sides with same value for Title.
    ZoomBandChart.setTitleMargin(40)

    Returns

    Chart itself for fluent interface

    Parameters

    • marginPixels: number | Partial<Margin>

      Gap after the chart title in pixels.

    Returns ZoomBandChart