123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- function initSubjectBadEcharts() {
- var xAxis_data = [
- "语文",
- "数学",
- "英语",
- "物理",
- "地理",
- "化学",
- "道德与法治",
- "历史",
- "生物"
- ];
- var series_data = [12, 20, 15, 8, 7, 11, 13, 15, 8];
- var option = {
- animation: false,
- title: {
- text: "人",
- x: "left",
- y: "top",
- textStyle: {
- color: "#5F6E82",
- fontSize: $.UnitUtil.mm2px(3),
- fontWeight: 500,
- },
- },
- color: ["#5C99FF"],
- legend: {
- itemWidth: $.UnitUtil.mm2px(2),
- itemHeight: $.UnitUtil.mm2px(2),
- top: "bottom",
- data: ["违纪人数"],
- },
- grid: {
- top: $.UnitUtil.mm2px(10),
- left: 0,
- right: 0,
- bottom: $.UnitUtil.mm2px(8),
- containLabel: true,
- },
- xAxis: [
- {
- type: "category",
- data: xAxis_data,
- axisLabel: {
- color: "#5F6E82", //更改坐标轴文字颜色
- interval: 0
- },
- axisTick: {
- alignWithLabel: true,
- },
- boundaryGap: true,
- triggerEvent: true,
- axisLine: {
- show: true, //是否显示轴线
- lineStyle: {
- color: "#DADADA", //刻度线的颜色
- },
- },
- },
- ],
- yAxis: [
- {
- type: "value",
- axisTick: {
- show: false, //刻度
- },
- axisLine: {
- show: false, //是否显示轴线
- lineStyle: {
- color: "#DADADA", //刻度线的颜色
- },
- },
- splitLine: {
- //网格线
- lineStyle: {
- type: "dotted", //设置网格线类型 dotted:虚线 solid:实线
- },
- show: true, //隐藏或显示
- },
- axisLabel: {
- color: "#5F6E82", //更改坐标轴文字颜色
- },
- },
- ],
- series: [
- {
- name: "违纪人数",
- type: "bar",
- barWidth: $.UnitUtil.mm2px(5),
- // 柱状图最小高度
- barMinHeight: $.UnitUtil.mm2px(2),
- barGap: 0,
- label: {
- normal: {
- show: true,
- align: "center",
- verticalAlign: "bottom",
- position: "top",
- distance: 0,
- formatter: "{c}",
- },
- },
- data: series_data,
- },
- ],
- };
- var myEcharts = echarts.init(document.querySelector(".section_3 #subjectBadEcharts"));
- myEcharts.clear();
- myEcharts.setOption(option);
- }
- $(function () {
- // outerHeight(true) 高度为 height+margin+padding+border
- var parameter = $(".section_3_html_root").data("page-params");
- console.log("section_3:parameter", parameter);
-
- initSubjectBadEcharts();
- });
|