简体   繁体   English

增加Anychart散点图中特定标记点的大小

[英]Increase size of specific marker points in Anychart scatter charts

I am creating a scatter chart using AnyChart 我正在使用AnyChart创建散点图

 anychart.onDocumentReady(function () { var data_1 = [["1", "82"], ["1", "90"], ["1", "78"], ["1", "86"], ["1", "86"], ["1", "88"], ["1", "86"], ["2", "87"], ["2", "90"], ["2", "87"], ["2", "90"], ["2", "67"], ["2", "90"], ["2", "77"], ["3", "82"], ["3", "96"], ["3", "82"], ["3", "80"], ["3", "93"], ["3", "67"], ["3", "87"], ["4", "66"], ["4", "91"], ["4", "71"], ["4", "77"], ["4", "77"], ["4", "80"], ["4", "83"], ["5", "76"], ["5", "82"], ["5", "62"], ["5", "78"], ["5", "84"], ["5", "78"], ["5", "76"]], chart = anychart.scatter(); var series1 = chart.marker(data_1); series1.tooltip() .hAlign('start') .format(function () { return 'Value: ' + this.value; }); chart.getSeriesAt(0).name("Score"); chart.xScale().minimum(0).ticks().interval(1); chart.xAxis(0).drawFirstLabel(false).drawLastLabel(false); xLabels = chart.xAxis().labels(); xLabels.format(function (x) { var xLabel; xLabel = x.value; return xLabel; }); xLabels.fontSize(10); xLabels.width(60); xLabels.height(25); xLabels.textOverflow("..."); xLabels.hAlign("center"); chart.xGrid(true); chart.yGrid(true); chart.xMinorGrid(true); chart.yMinorGrid(true); chart.yScale().minimum(40); chart.yScale().maximum(100); chart.container('container'); chart.draw(); }); 
 html, body, #container { width: 100%; height: 100%; margin: 0; padding: 0; } 
 <script src="https://cdn.anychart.com/releases/8.2.1/js/anychart-bundle.min.js"></script> <div id="container"></div> 

I am trying to increase the size of specific marker points on the chart. 我正在尝试增加图表上特定标记点的大小。

For example: Corresponding to the x value "1" we have three "86" y values. 例如:对应于x值“ 1”,我们有三个“ 86” y值。

["1", "82"], ["1", "90"], ["1", "78"], ["1", "86"], ["1", "86"], ["1", "88"], ["1", "86"]

So I need to display that marker point with increased size. 因此,我需要以更大的尺寸显示该标记点。 How is it possible? 这怎么可能?

do you need markers of different types sized according to the value or maybe bubble charts are what you are looking for https://playground.anychart.com/teKDUPCH ? 您是否需要根据值大小不同的类型的标记,或者气泡图是您正在寻找的https://playground.anychart.com/teKDUPCH

    var series1 = chart.bubble(data_1);

    chart.maxBubbleSize(20);
    chart.minBubbleSize(1);

 anychart.onDocumentReady(function () { var data_1 = [ {x: "1", value: "82", size: "1"}, {x: "1", value: "90", size: "1"}, {x: "1", value: "78", size: "1"}, {x: "1", value: "86", size: "3"}, {x: "1", value: "88", size: "1"}, {x: "2", value: "87", size: "2"}, {x: "2", value: "90", size: "3"}, {x: "2", value: "67", size: "1"}, {x: "2", value: "77", size: "1"}, {x: "3", value: "82", size: "2"}, {x: "3", value: "96", size: "1"}, {x: "3", value: "80", size: "1"}, {x: "3", value: "93", size: "1"}, {x: "3", value: "67", size: "1"}, {x: "3", value: "87", size: "1"}, {x: "4", value: "66", size: "1"}, {x: "4", value: "91", size: "1"}, {x: "4", value: "71", size: "1"}, {x: "4", value: "77", size: "2"}, {x: "4", value: "80", size: "1"}, {x: "4", value: "83", size: "1"}, {x: "5", value: "76", size: "2"}, {x: "5", value: "82", size: "1"}, {x: "5", value: "62", size: "1"}, {x: "5", value: "78", size: "2"}, {x: "5", value: "84", size: "1"}, ]; var chart = anychart.bubble(data_1); chart.tooltip() .hAlign('start') .format(function () { return 'Value: ' + this.value + '\\n' + 'Count: ' + this.size; }); chart.getSeriesAt(0).name("Score"); chart.minBubbleSize("2%"); chart.maxBubbleSize("4%"); chart.xScale().minimum(0).ticks().interval(1); chart.xAxis(0).drawFirstLabel(false).drawLastLabel(false); xLabels = chart.xAxis().labels(); xLabels.format(function (x) { var xLabel; xLabel = x.value; return xLabel; }); xLabels.fontSize(10); xLabels.width(60); xLabels.height(25); xLabels.textOverflow("..."); xLabels.hAlign("center"); chart.xGrid(true); chart.yGrid(true); chart.xMinorGrid(true); chart.yMinorGrid(true); chart.yScale().minimum(40); chart.yScale().maximum(100); chart.container('container'); chart.draw(); }); 
 html, body, #container { width: 100%; height: 100%; margin: 0; padding: 0; } 
 <script src="https://cdn.anychart.com/releases/8.2.1/js/anychart-bundle.min.js"></script> <div id="container"></div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM