Вы можете располагать и восстанавливать серии, если у вас есть ссылки на них.
// Use PointSeries with Triangle shaped points as example and cache it.
const triangleSeries = chart.addPointSeries( { pointShape: PointShape.Triangle } )
// Add a checkbox to the chart for this example
const button = chart.addUIElement( UIElementBuilders.CheckBox )
// Set up the checkbox
button.setText('Click to hide/show series')
.setPosition( {x: 95, y: 95 } )
// Define the behavior when the button is clicked (changing its state)
.onSwitch( (_, state) => {
// The checkbox is in 'on' state, so restore series.
if (state)
// Restore the series to the chart, so it'll show in the chart again.
triangleSeries.restore()
else
// Dispose the series from the chart, effectively 'hiding' it.
triangleSeries.dispose()
})
Вы можете изменить формы флажков, используя setPictureOff
или setPictureOn
методы UIElementBuilder:
// Create a checkbox
const checkBox = chart.addUIElement( UIElementBuilders.CheckBox
// Modify the shape of the checkbox
.setPictureOff(UIButtonPictures.Rectangle)
.setPictureOn(UIButtonPictures.Rectangle)
)