效果图

87Echarts - 散点图(Visual interaction with stream)

源代码

<!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;

			$.getJSON('data/asset/data/house-price-area2.json', function (data) {

			    var option = {
			        title: {
			            text: 'Dispersion of house price based on the area',
			            left: 'center',
			            top: 0
			        },
			        visualMap: {
			            min: 15202,
			            max: 159980,
			            dimension: 1,
			            orient: 'vertical',
			            right: 10,
			            top: 'center',
			            text: ['HIGH', 'LOW'],
			            calculable: true,
			            inRange: {
			                color: ['#f2c31a', '#24b7f2']
			            }
			        },
			        tooltip: {
			            trigger: 'item',
			            axisPointer: {
			                type: 'cross'
			            }
			        },
			        xAxis: [{
			            type: 'value'
			        }],
			        yAxis: [{
			            type: 'value'
			        }],
			        series: [{
			            name: 'price-area',
			            type: 'scatter',
			            symbolSize: 5,
			            // itemStyle: {
			            //     normal: {
			            //         borderWidth: 0.2,
			            //         borderColor: '#fff'
			            //     }
			            // },
			            data: data
			        }]
			    };
			myChart.setOption(option);
		</script>
	</body>

</html>

相关文章:

  • 2021-05-30
  • 2021-06-28
  • 2021-12-11
  • 2021-08-20
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
  • 2021-10-29
猜你喜欢
  • 2021-09-21
  • 2021-12-06
  • 2021-10-06
  • 2021-12-22
  • 2021-12-09
  • 2021-08-27
相关资源
相似解决方案