当前位置:网站首页>About chartjs screen size adaptation
About chartjs screen size adaptation
2022-04-22 13:17:00 【shmilyhq】
html Code
<div class="">
<div id="popChart" style="width: 100%;height:300px;"></div>
</div>
quote echarts.js
<!--echarts-->
<script src="/js/chart/echarts.min.js" type="text/javascript"></script>
js Code
let system = "";
if ($('#source').val().length != 0){
system += '-'+ $('#source option:selected').text();
}
let text = '【'+$('#year').val()+system+'】 Quantity histogram ';
let myChart = echarts.init(document.getElementById('popChart'));
myChart.clear();
$.ajax({
method: 'get',
url: "xxx/list",
data: date,
success: function (r) {
if (r.code == 0) {
let dataTrans = JSON.parse(r.msg);
let option = {
title:{
text: text, // title
x: 'center', // Horizontal center
},
tooltip: {
trigger: 'item',
formatter: "{b} : {c}" // Mouse hover display x/y The value of the shaft
},
//x Axis
xAxis: {
name: ' month ',
type: 'category',
data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']
},
//y Axis
yAxis: {
name: ' Number ',
},
series: [{
data: [
dataTrans['januaryNum'],
dataTrans['februaryNum'],
dataTrans['marchNum'],
dataTrans['aprilNum'],
dataTrans['mayNum'],
dataTrans['juneNum'],
dataTrans['julyNum'],
dataTrans['augustNum'],
dataTrans['septemberNum'],
dataTrans['octoberNum'],
dataTrans['novemberNum'],
dataTrans['decemberNum']
],
type: 'bar', // Icon type Histogram
itemStyle: {
background:'#3A7BD5', // Graphic color
normal: {
color: '#3A7BD5', // The font color
label: {
show: true, // Turn on the display
position: 'top', // Show above
textStyle: {
// Numerical pattern
color: '#3A7BD5', // Numeric color
fontSize: 12, // font size
},
},
},
},
}]
};
myChart.setOption(option, true); // Load data
// Screen adaptation key code
window.addEventListener("resize", function () {
myChart.resize(); });
} else {
layer.msg(r.msg);
}
}
});
The effect is shown below :

版权声明
本文为[shmilyhq]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221315155583.html
边栏推荐
- English writing artifact quillbot --- how to use the free premium function
- Altium Designer导出Gerber文件的一般步骤
- 手把手教你配置哔哔点啥
- ROS机器人学习——TF坐标变换
- MapReduce案例-上行流量倒序排序(递减排序)
- Compressed backup of raspberry pie
- Alibaba cloud changes its commander and competes for Huawei's territory
- The data in MATLAB is forcibly converted from double type to uint8, which is rounded, and the basic data type of MATLAB is attached
- 最大匹配数,最小路径覆盖数,最大独立数,最小点覆盖数 定理总结
- Rsync remote synchronization
猜你喜欢

The keys of redis have become backup and the values have disappeared. Why?

Station B cuts to the live broadcast, sooner or later

Redisconfig configuration class

难得盈利或是昙花一现,达芙妮学不会南极人

B站砍向直播,迟早的事
![[introduction to keras] MNIST dataset classification](/img/8f/1f9f8674c3212223af85eaec3a34f0.png)
[introduction to keras] MNIST dataset classification

抖音快手卧榻之侧,黄光裕难以酣睡

no main manifest attribute / .jar中没有主清单属性

It's rare to make a profit or a flash in the pan. Daphne can't learn from the Antarctic

C custom button implementation source code
随机推荐
托宾Q数据-沪深A股上市公司(含行业名称、代码等指标)2003-2020
封装统一响应结果枚举类(工具模块)
B站砍向直播,迟早的事
Redisconfig configuration class
各省GTFP绿色全要素生产率面板数据(2004-2018年)
ROS2——手把手教你编写一个话题
Ros2 - what is an interface
分块——优雅的暴力
Advertising offensive and defensive war of Internet giants
算法---设计推特(Kotlin)
R language uses qlogis function to generate the quantile function data of logistic distribution, and uses plot function to visualize the quantile function data of logistic distribution
Altium Designer导出Gerber文件的一般步骤
稻盛和夫:直面现实、拼命思考、正面迎击
The compatibility certification of ecological Wanli database and Yixin technology has been completed
500 Internal Server Error错误补充
no main manifest attribute / .jar中没有主清单属性
Share the five cases of websites slowing down recently
Deep learning notes (I error)
Type requirements for parameters pT1 and pT2 of OpenCV function line()
MapReduce案例-上行流量倒序排序(递减排序)