75Echarts - 散点图(Large Scatter)

简介: 75Echarts - 散点图(Large Scatter)
效果图

源代码
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>ECharts</title>
    <!-- 引入 echarts.js -->
    <script src="js/echarts.min.js"></script>
  </head>
  <body>
    <!-- 为ECharts准备一个具备大小(宽高)的Dom -->
    <div id="main" style="width: 600px;height:400px;"></div>
    <script type="text/javascript">
      // 基于准备好的dom,初始化echarts实例
      var myChart = echarts.init(document.getElementById('main'));
      var option;
      function genData(len, offset) {
        var lngRange = [-10.781327, 131.48];
        var latRange = [18.252847, 52.33];
        var arr = new Float32Array(len * 2);
        var off = 0;
        for(var i = 0; i < len; i++) {
          var x = +Math.random() * 10;
          var y = +Math.sin(x) - x * (len % 2 ? 0.1 : -0.1) * Math.random() + (offset || 0) / 10;
          arr[off++] = x;
          arr[off++] = y;
        }
        return arr;
      }
      var data1 = genData(5e5);
      var data2 = genData(5e5, 10);
      option = {
        title: {
          text: echarts.format.addCommas(data1.length / 2 + data2.length / 2) + ' Points'
        },
        tooltip: {},
        toolbox: {
          left: 'center',
          feature: {
            dataZoom: {}
          }
        },
        legend: {
          orient: 'vertical',
          right: 10
        },
        xAxis: [{}],
        yAxis: [{}],
        dataZoom: [{
          type: 'inside'
        }, {
          type: 'slider'
        }],
        animation: false,
        series: [{
          name: 'A',
          type: 'scatter',
          data: data1,
          dimensions: ['x', 'y'],
          symbolSize: 3,
          itemStyle: {
            opacity: 0.4
          },
          large: true
        }, {
          name: 'B',
          type: 'scatter',
          data: data2,
          dimensions: ['x', 'y'],
          symbolSize: 3,
          itemStyle: {
            opacity: 0.4
          },
          large: true
        }]
      };
      myChart.setOption(option);
    </script>
  </body>
</html>
目录
相关文章
73Echarts - 散点图(Effect Scatter Chart)
73Echarts - 散点图(Effect Scatter Chart)
61 0
|
3月前
echarts中使用散点scatter更改颜色却不生效的问题
本文讨论了在ECharts中使用散点图(scatter)时更改颜色不生效的问题。原因是项目中使用了`visualMap`组件,它具有最高的优先级,导致自定义的颜色设置被覆盖。解决方法是在`visualMap`组件中增加`seriesIndex`属性,指定它只对特定的系列(series)生效,从而避免影响散点图的颜色设置。文章提供了详细的代码示例和解决办法。
91 2
195Echarts - 自定义系列(Error Scatter on Catesian)
195Echarts - 自定义系列(Error Scatter on Catesian)
26 0
81Echarts - 散点图(Scatter Nutrients Matrix)
81Echarts - 散点图(Scatter Nutrients Matrix)
53 0
81Echarts - 散点图(Scatter Nutrients Matrix)
268Echarts - GL 关系图(GraphGL - Large Internet)
268Echarts - GL 关系图(GraphGL - Large Internet)
126 0
244Echarts - 3D 散点图(3D Scatter with Scatter Matrix)
244Echarts - 3D 散点图(3D Scatter with Scatter Matrix)
64 0
242Echarts - 3D 散点图(3D Scatter with Dataset)
242Echarts - 3D 散点图(3D Scatter with Dataset)
154 0
211Echarts - 数据区域缩放(Error Scatter on Catesian)
211Echarts - 数据区域缩放(Error Scatter on Catesian)
41 0
210Echarts - 数据区域缩放(Large scale area chart)
210Echarts - 数据区域缩放(Large scale area chart)
118 0
158Echarts - 平行坐标系(Scatter Matrix)
158Echarts - 平行坐标系(Scatter Matrix)
37 0

热门文章

最新文章