散点图单独大小设置大小

Setting size for individual size for scatter chart

我们可以更改单个散点系列项目的大小吗?现在这可以改变颜色

点系列

 .add([
        { x: 2.5, y: 0, color: ColorRGBA( 255, 0, 0 ) },
        { x: 5, y: 10 },
        { x: 7.5, y: 20, color: ColorRGBA( 0, 255, 0 ) },
        { x: 10, y: 30, color: ColorRGBA( 0, 0, 255 ) },
    ])

类似

    { x: 2.5, y: 0, color: ColorRGBA( 255, 0, 0 ) , size : 2 },

可以指定单个点的大小PointSeries

您需要使用 series.setIndividualPointSizeEnabled(true) 启用单独的点大小调整,以便在添加新点时启用 size 字段。然后,您可以在将点添加到系列时包含尺寸信息。 series.add({ x: 2.5, y: 0, size: 30 })

series.setPointSize 可用于定义未定义单个尺寸的点的尺寸。

const {
    lightningChart,
    IndividualPointFill,
    ColorRGBA
} = lcjs

const lc = lightningChart()
const chart = lc.ChartXY()

const series = chart.addPointSeries()

series.setIndividualPointSizeEnabled(true)
series.setPointFillStyle(new IndividualPointFill())
series.setPointSize(10)

series.add([
    { x: 2.5, y: 0, color: ColorRGBA(255, 0, 0), size: 30 },
    { x: 5, y: 10 },
    { x: 7.5, y: 20, color: ColorRGBA(0, 255, 0), size: 5  },
    { x: 10, y: 30, color: ColorRGBA(0, 0, 255), size: 20  },
])
<script src="https://unpkg.com/@arction/lcjs@2.2.1/dist/lcjs.iife.js"></script>