百度这个图表支持不是很好,有的需要自己写,看大神们实现温度计都是用 水球特效实现的我这里雕虫小计啊但是满足我了我的项目需求特此分享出来,可惜自己不是专业的前端


这是我的实现结果

好了上代码
html:

    <div id="main" style="width: 400px; height: 400px;">

js代码:

    <script>
var myChart = echarts.init(document.getElementById("main"));
var data = [50];
var xMax = 80;
var axisColor = '#fff';
option = {
tooltip: {
show: true,
formatter: "{b} <br> {c}" },
yAxis: [{
min:0,
max:70,
position:'left',
offset:-140,
axisTick: {
show: true,
// color:'#fff',
},
axisLine: {
show: false,
},
axisLabel: {
show: true,
formatter:function(value,index){
return value-20;
}
//color:'#fff',
},
splitLine: {
show: false,
// color:'#fff',
},
splitNumber :10,
}],
xAxis: [{
type: 'category',
data: ['温度'],
axisTick: {
// color:'#fff',
show: false,
},
axisLine: {
// color:'#fff',
show: false,
},
axisLabel: {
textStyle: {
color: '#fff',
}
} }],
series: [{
name: ' ',
type: 'bar',
barWidth: 40,
silent: true, itemStyle: {
normal: {
color: '#fdd',
barBorderRadius: [0, 0, 0, 0], } },
barGap: '-100%', //barCategoryGap: '60%',
data: data.map(function(d) {
return xMax
}),
}, {
name: ' ',
type: 'bar',
barWidth: 40,
label: {
normal: {
show: true,
position: 'top',
formatter: function(o){
return o.value-30+'℃';
},
}
},
data: [{
value: 15+30,
itemStyle: {
normal: {
barBorderRadius: [0, 0, 0, 0],
color: {
type: 'bar',
colorStops: [{
offset: 0,
color: 'rgba(225,42,84,.3)' // 0% 处的颜色
}, {
offset: 1,
color: '#ffa800' // 100% 处的颜色
}],
globalCoord: false, // 缺省为 false }
}
}
} ],
}]
}; myChart.setOption(option);
</script>

js脚本的引入<script type="text/javascript" src="css/echarts.min.js">单文件引入

最新文章

  1. 【知识必备】ezSQL,最好用的数据库操作类,让php操作sql更简单~
  2. Akka-actor使用入门
  3. C# 可视化读取文件、文件夹
  4. Windows 8.1 新增控件之 CommandBar
  5. selenium and win32api
  6. 模拟 ZOJ 3736 Pocket Cube
  7. JavaScript判断闰年
  8. java类的加载以及初始化顺序
  9. [AngularJS] Accessible Button Events
  10. C语言中输入输出格式控制
  11. win8 64位 mysql安装 Configuration file my.ini error code -1
  12. Java - 反射机制 2
  13. swift 经典代码收集 和 赏析
  14. ios发送邮件
  15. 1、Android测试入门
  16. 【运维】Dell R710如何做Raid0与Raid5
  17. 理解ES6中的Promise
  18. ERP简介(一)
  19. Fibonacci PKU logn 求斐波那契的快速方法!!!
  20. 写自己的ASP.NET MVC框架(下)

热门文章

  1. Work Scheduling(带反悔的贪心)
  2. G - KiKi&#39;s K-Number(树状数组求区间第k大)
  3. TensorFlow 介绍
  4. SQLserver安装了多个实例,实例端口号也被修改后的代码连接方式
  5. linux下添加行数和修改tab空格数
  6. PHP--foreach的问题
  7. HDU-6312-Game
  8. Markdown 内嵌 HTML 语法
  9. Python的初级语法
  10. dos窗口运行python文件提示找不到模块