You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用JSCharting避免系列遮挡Y轴

解决JSCharting垂直标记线被系列遮挡的问题

要让Y轴的"Fecha actual"标记线显示在系列上方,只需在标记线配置中添加layer: 'top'属性,强制将标记线渲染在所有图表元素的顶层:

修改后的代码如下:

yAxis: {
    markers: [
        {
            value: fechaActual,
            color: '#b0be5f',
            label_text: 'Fecha actual',
            layer: 'top' // 添加此行,将标记线置于顶层
        }
    ]
},
defaultSeries: {
    defaultPoint: {
        legendEntry: {
            value: '{days(%max-%min):number n0} days'
        },
        tooltip: '<b>%name</b> <br/>%low - %high<br/>{days(%high-%low)} días',
        marker_type: 'diamond'
    },
    firstPoint: {
        xAxisTick: {label: {text: '<b>%name</b>', style: {fontSize: '14px'}}},
        outline: {color: 'darkenMore', width: 3}
    }
}

原理:JSCharting通过layer属性控制元素渲染层级,默认标记线层级低于系列元素,设置layer: 'top'会让标记线覆盖在所有系列、数据点等元素之上,彻底解决遮挡问题。

内容的提问来源于stack exchange,提问作者Gorka

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 12:25:08