Interface that defines end user API for a 'Chart'.

Hierarchy

  • ChartAPI

Implemented by

Methods

  • Get fillstyle of chart background.

    Returns

    FillStyle

    Returns FillStyle

  • Get stroke style of chart background.

    Returns

    LineStyle

    Returns LineStyle

  • Get padding around Chart in pixels.

    Returns

    Padding datastructure

    Returns Margin

  • Get text of Chart title.

    Returns

    Chart title as a string.

    Returns string

  • Get fill style of Chart Title.

    Returns

    FillStyle object

    Returns FillStyle

  • Get title margins.

    undefined values refer to default title margins.

    Returns

    Margin after Chart title

    Returns Partial<Margin>

  • Set padding around Chart in pixels.

     // Example 1, specify complete padding (four sides).
    ChartXY.setPadding({ left: 16, right: 16, top: 32, bottom: 8 })
     // Example 2, specify only single padding.
    ChartXY.setPadding({ right: 64 })

    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 ChartAPI

  • Set text displayed by charts built-in title component.

     // Example, set title.
    ChartXY.setTitle('Realtime traffic visualization')

    **NOTE: To hide title, AND remove padding around it, ** use setTitleFillStyle(emptyFill)

    Returns

    Object itself for fluent interface.

    Parameters

    • title: string

      Chart title as a string.

    Returns ChartAPI

  • Set fill style of Chart Title.

    Example usage:

    // Create a new style
    setTitleFillStyle(new SolidFill({ color: ColorHEX('#F00') }))
    // Change transparency
    setTitleFillStyle((solidFill) => solidFill.setA(80))
    // Set hidden
    setTitleFillStyle(emptyFill)

    Returns

    Chart itself

    Parameters

    Returns ChartAPI

  • Specifies Margins after chart title. This can be used to account for extra space around the title as well as tweak its position.

    This does not have an effect if title is hidden (empty FillStyle or text content '').

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

    Returns

    Chart itself for fluent interface

    Parameters

    • marginPixels: number | Partial<Margin>

      Gap after the chart title in pixels.

    Returns ChartAPI