JS echarts统计
柱状图
function drawbarFunc(xs, ys) {
//var xs1 = [];
//var ys1 = [];
require.config({
paths: {
echarts: '/Script/plugins/echarts/dist'
}
});
require(
[
'echarts',
'echarts/chart/bar' // 使用柱状图就加载bar模块,按需加载
],
function (ec) {
var myChart = ec.init(document.getElementById('pieChart'));
var option = {
title: {
text: '评分统计',
//subtext: '纯属虚构'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['平均分']
},
toolbox: {
show: true,
feature: {
//mark: { show: true },
//dataView: { show: true, readOnly: false },
//magicType: { show: true, type: ['line', 'bar'] },
//restore: { show: true },
saveAsImage: { show: true }
}
},
calculable: true,
xAxis: [
{
type: 'category',
data: xs,
axisLabel: {
interval: 0,
rotate: -40
}
}
],
grid: {
x: 40,
x2: 100,
y2: 200
},
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '平均分',
type: 'bar',
data: ys,
itemStyle: {
normal: {
label: {
show: true, //开启显示
position: 'top', //在上方显示
textStyle: { //数值样式
color: 'black',
fontSize: 16
}
}
}
}
}
]
};
myChart.setOption(option);
}
);
}
折线图
function drawbarFunc(xs, ys, linevalue) {
//var xs1 = [];
//var ys1 = [];
require.config({
paths: {
echarts: '/Script/plugins/echarts/dist'
}
});
require(
[
'echarts',
'echarts/chart/line' // 使用柱状图就加载bar模块,按需加载
],
function (ec) {
var myChart = ec.init(document.getElementById('pieChart'));
var option = {
title: {
text: '上座人数统计',
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['听众人数']
},
toolbox: {
show: true,
feature: {
//mark: { show: true },
//dataView: { show: true, readOnly: false },
//magicType: { show: true, type: ['line'] },
//restore: { show: true },
saveAsImage: { show: true }
}
},
calculable: true,
xAxis: [
{
type: 'category',
data: xs,
//axisLabel: {
// interval: 0,
// rotate: -40 //选择-40°
//},
boundaryGap: false,
nameTextStyle: { fontSize: 100 },
axisLabel: {
show: true,
textStyle: {
fontSize: 20
}
}
}
],
yAxis: [
{
type: 'value',
axisLabel: {
formatter: '{value} 人'
},
axisLabel: {
show: true,
textStyle: {
fontSize: 20
}
}
}
],
visualMap: {
show: true,
pieces: [
{
gt: 0,
lte: linevalue, //这儿设置基线上下颜色区分 基线下面为绿色
color: '#03d6d6'
}, {
gt: linevalue, //这儿设置基线上下颜色区分 基线上面为红色
color: '#e91642'
}]
},
//grid: {
// x: 40,
// x2: 100,
// y2: 200
//},
series: [
{
name: '听众人数',
type: 'line',
data: ys,
itemStyle: {
normal: {
label: {
show: true, //开启显示
position: 'top', //在上方显示
textStyle: { //数值样式
color: 'black',
fontSize: 20
}
}
}
}//,
//markLine: {
// data: [
// { name: '标线1起点', value: 800, x: xs[0], y: ys[0] },
// { name: '标线1终点', x: xs[ys.length - 1], y: ys[ys.length - 1] }
// ]
//}
}
]
};
myChart.setOption(option);
}
);
}
JS echarts统计的更多相关文章
- 如何在js中将统计代码图标隐藏
建站时我们都会加一下网站统计,方便把控内容的内容的运营.大部分站长安装的站点统计是第三方统计代码,js形式的,很少用以服务器日志为基础分析的统计.(当然能通过网站日志来分析网站的运营者比一般的站长水平 ...
- Python+Django+js+echarts引入本地js文件的操作方法
1. 选择正确的echarts.js,开发版选择echarts.baidu.com上的源码版,避免出现问题 2. 在项目主目录中新建static文件夹,里面建立js.css.images文件夹 3. ...
- SaaS系统怎么做物流行业年度经营报告,MVC+js+echarts实现
前言 马上就到年底了,很多公司都要汇总这一年的经营情况,如果一个系统没有自动生成年报的功能, 需要人工手工去做年报,我相信可能是一个不小的工作量,最近我通过一个星期的时间,结合系统情况自动生成年报,全 ...
- echarts统计x轴区间的数值
有时我们需要统计自定义echarts图,统计x轴区间的y轴数量. 思路是利用echarts的自定义配置:option.series[i].type='custom'中的renderItem(param ...
- WebGIS中利用AGS JS+eCharts实现一些数据展示的探索
文章版权由作者李晓晖和博客园共有,若转载请于明显处标明出处:http://www.cnblogs.com/naaoveGIS/. 1.背景 eCharts提供了迁徙图.热点图.夜视图等跟地图能够很好的 ...
- 一个用vue-cli vue-router2.1 vue 2.1 vuex2.1 echarts统计 express 的 时间轴 记录每天活动
界面还挺好看的... 可以记录每天的点点滴滴... 1.使用 express 作为服务器 2.fs 模块 fs.writeFileSync 随机写入模拟数据 3.vuex 包括 states 存储数据 ...
- 发现百度开源一个好东西,Echarts统计报表前段框架
1,如今数据越来越重要了 可是数据报表的可视化展示一直是个问题. 如今好了.有Echarts能够解决一部分数据展示的问题. http://echarts.baidu.com/index.html 类似 ...
- JS输入框统计文字数量
$('#articleTitle').bind('input propertychange',function () { var a = $(this).val().length; if(a>3 ...
- 【js】统计数组中某些项的个数
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
随机推荐
- JAVA8-用lamda表达式和增强版Comparator进行排序
1.单条件升序: list.sort(Comparator.comparing(User::getId); 2.降序: list.sort(Comparator.comparing(User::get ...
- Flex:实例
目的: 代码: <!--pages/index/index.wxml--> <view class="container"> <view class= ...
- IIS 部署 web service
1.在控制台检查 IIS 功能是否已经全部启用 2.重新注册IIS 3.设定程序池的正确版本
- C# 集合类型学习
如果你掌握了一门语言的数据结构 ,那么你离掌握这门语言 也不远了 1.列表 对于list,值得一提的是 Capacity 属性,使用默认的构造函数 ,让我们用代码来说明 var intList = n ...
- k8s 的pod进阶
容器探测的具体实现方法:三种探针类型 ExecAction.TCPSocketAction.HTTPGetAction lifecycle <Object> Actions that th ...
- CDH
CDH 1.CDH简介 CDH 2.Cloudera Manager的安装 软件下载地址: 链接:https://pan.baidu.com/s/1C5HpiVEOtH_4PjylyJaXvA ...
- xml 写sql语句文件头
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE mapper PUBLIC "-/ ...
- Day11 - B - Dice (III) LightOJ - 1248
设dp_i为已经出现了i面,需要的期望次数,dp_n=0 那么dp_i= i/n*dp_i + (n-i)/n*dp_(i+1) + 1 现在已经i面了,i/n的概率再选择一次i面,(n-i)/n的概 ...
- LoadRunner的Capture Level
场景:录制loadrunner的web站点 问题:录制的过程中发现除了页面正常的请求外还有些看不懂的请求(包含乱码),脚本如下: web_url("WebTours", " ...
- [转]No configuration found for the specified action 原因及解决方案
转自 报错内容 警告: No configuration found for the specified action: 'login' in namespace: ''. Form action d ...