Skip to content

ChartLegend

ChartLegend is a DOM-based component that draws an entry for each data-series. It can be used with v-model as a graphical series toggler when used in combination with SeriesToggler.

Props

nametypedefaultrequireddescription
dataSetsDataSetN/A🗹The dataSets to draw legend entries for
domStateDOMStateN/A🗹
marginsMarginsN/A🗹
modelValuenumber[]N/A🗹You can pass a ChartLegend a v-model of a list of plot ids and the legend can toggle them on and off by adding/removing from this list and emitting the changes
marginPxnumber10margin around legend in pixels
toolTipInfoToolTipInfo{}A mapping of data series id to the nearestPoint for that series (if the mouse is close enough to one)

Slots

perSeries

This slot will draw for every dataset, activated or not

proptypecomment
dataSetDataSetThe dataSet for this series
dataSeriesNumbernumberThe index in dataSets this series represents
nearestPointNearestPointnearest point for this series
activateSeries() => voidA callback function to activate this series
deactivateSeries() => voidA callback function to deactivate this series
seriesIsActivebooleantrue is the series is active

beforeDatasets

This slot defaults to empty and is directly before the loop of perSeries

afterDatasets

This slot defaults to empty and is directly after the loop of perSeries

beforeThresholds

This slot defaults to empty and is directly before the loop of thresholds

afterThresholds

This slot defaults to empty and is directly after the loop of thresholds

Released under the MIT License.