你如何延伸Highcharts来完成一个"手绘"效果(例如:https://www.amcharts.com/demos/column-and-line-mix/?theme=chalk)。
或者可以使用库完成吗?
答案 0 :(得分:0)
在Highcharts中实现它需要一些核心代码分析和包装/覆盖SVGRenderer
方法。
示例强>
列点是SVG rect
的形状:
https://github.com/highcharts/highcharts/blob/master/js/parts/ColumnSeries.js
translate
功能:
// Register shape type and arguments to be used in drawPoints
point.shapeType = 'rect';
drawPoints
功能:
point.graphic = graphic =
renderer[point.shapeType](shapeArgs)
.add(point.group || series.group);
SVGRenderer
(https://github.com/highcharts/highcharts/blob/master/js/parts/SvgRenderer.js)包含rect
方法,可以对其进行包装/覆盖,以便返回复杂路径(手写效果)而不是简单{ {1}}标记。
关于包装/覆盖的文档: https://www.highcharts.com/docs/extending-highcharts/extending-highcharts