charts - 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]);
如果有人可以帮助并解释如何删除或设计这些物品,那就太好了。提前谢谢。
解决方案
轴线末端的小线称为“笔尖”。您可以使用 设置和隐藏笔尖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>
推荐阅读
- java - Spring Boot 版本升级性能问题
- flutter - 如何正确定期进行http请求?
- python - 使用 PyPDF2 和 pdfrw 解析 PDF 时出现外部参照错误?
- java - 从远程 REST API 测试用例调用回滚数据库更改
- javascript - 根据特定值识别数组中的唯一对象
- bash - 一旦进程运行,Bash脚本不会退出
- locust - 在 Locust 中执行基本代码时出错
- javascript - Javascript 函数(多个)
- elasticsearch - Elasticsearch查找相交和范围内的日期使用范围查询
- html - 水平滚动条不出现