首页 > 解决方案 > LightningChart js中的样式/删除轴重叠指示器

问题描述

我想在 LightningChartJs 中设置轴的样式,并且无法删除轴重叠和轴末端的小线(请参见下图)。

设置轴的粗细对指标没有影响:

const axisYStyles = axisYColors.map((color) => new SolidFill({ color }));
const axisYStrokeStyles = axisYStyles.map((fillStyle) => new SolidLine({ fillStyle, thickness: 1 }));
    
const axisX = this.chart.getDefaultAxisX()
                            .setStrokeStyle(axisYStrokeStyles[0]);

如果有人可以帮助并解释如何删除或设计这些物品,那就太好了。提前谢谢。

闪电图表Js

标签: chartslightningchart

解决方案


轴线末端的小线称为“笔尖”。您可以使用 设置和隐藏笔尖Axis.setNibStyle()

emptyLine可用于完全去除轴和笔尖线。

// Axis styling
chart.getDefaultAxisX()
    // Hide the main axis line
    .setStrokeStyle(emptyLine)
    // Hide the Nib at the ends of the axis
    .setNibStyle(emptyLine)

// Extract required parts from LightningChartJS.
const {
    lightningChart,
    emptyLine
} = lcjs

const chart = lightningChart()
    .ChartXY()

// Axis styling
chart.getDefaultAxisX()
    // Hide the main axis line
    .setStrokeStyle(emptyLine)
    // Hide the Nib at the ends of the axis
    .setNibStyle(emptyLine)
chart.getDefaultAxisY()
    // Hide the main axis line
    .setStrokeStyle(emptyLine)
    // Hide the Nib at the ends of the axis
    .setNibStyle(emptyLine)
<script src="https://unpkg.com/@arction/lcjs@1.3.1/dist/lcjs.iife.js"></script>


推荐阅读