Highcharts 散点集标记

El *_*ude 1 javascript highcharts

如何在 Highchart 散点图中指定每个群体的标记形状?在我看来,它们是随机选择的还是从列表中选择的?

Blu*_*her 6

默认情况下,它们可能是随机选择的,但要明确设置它们,请尝试以下操作:

series: [{
    name: 'Predefined symbol',
    data: [316.4, 294.1, 195.6, 154.4],
    marker: {
        symbol: 'triangle'
    }
}],
Run Code Online (Sandbox Code Playgroud)

symbol属性可以指定一个形状或链接图标。还有一些非常酷的其他选项,例如使用以下代码创建自定义形状:

// Define a custom symbol path
Highcharts.SVGRenderer.prototype.symbols.cross = function (x, y, w, h) {
    return ['M', x, y, 'L', x + w, y + h, 'M', x + w, y, 'L', x, y + h, 'z'];
};
if (Highcharts.VMLRenderer) {
    Highcharts.VMLRenderer.prototype.symbols.cross = Highcharts.SVGRenderer.prototype.symbols.cross;
}
Run Code Online (Sandbox Code Playgroud)

这是有关此主题的 highcharts 文档的链接:

http://api.highcharts.com/highcharts#plotOptions.scatter.marker.symbol