Highcharts的一些属性

1<!DOCTYPE html> 2<html> 3 <head> 4 <meta charset="UTF-8"> 5 <title></title> 6 <script src="https://img.hcharts.cn/jquery/jquery-1.8.3.min.js"></script> 7 <script src="https://img.hcharts.cn/highcharts/highcharts.js"></script> 8 </head> 9 <body> 10 <script> 11 var chart; 12 $(function(){ 13 chart=new Highcharts.Chart({ 14 chart:{ 15 renderTo: 'container',//设置显示图表的容器 16 type: 'line',//设置图表样式,可以为line,spline, scatter, splinearea bar,pie,area,column 17 //defaultSeriesType: 'column', //图表的默认样式 18 //margin:[21, 23, 24, 54],//整个图表的位置(上下左右的空隙) 19 marginRight: 200,//右边间距 20 marginBottom: 25//底部间距/空隙 21 //inverted: false,//可选,控制显示方式,默认上下正向显示 22 //shadow:true,//外框阴影 23 //backgroundColor:"#FFF", 24 //animation:true, 25 //borderColor:"#888", 26 //borderRadius:5, 27 //borderWidth:1, 28 //ignoreHiddenSeries:true, 29 //reflow:true, 30 // plotBorderWidth:1, 31 //alignTicks:true 32 }, 33 34 labels:{//在报表上显示的一些文本 35 items:[{ 36 html:'本图表数据有误,仅用于说明相应的属性', 37 style:{left:'100px',top:'60px'} 38 }, { 39 html:'http://www.highcharts.com/demo', 40 style:{left:'100px',top:'100px'} 41 }] 42 }, 43 credits:{//右下角的文本 44 enabled: true, 45 position: {//位置设置 46 align: 'right', 47 x: -10, 48 y: -10 49 }, 50 href: "http://www.highcharts.com",//点击文本时的链接 51 style: { 52 color:'blue' 53 }, 54 text: "Highcharts Demo"//显示的内容 55 }, 56 57 //plotOptions:{//绘图线条控制 58 // spline:{ 59 // allowPointSelect :true,//是否允许选中点 60 // animation:true,//是否在显示图表的时候使用动画 61 // cursor:'pointer',//鼠标移到图表上时鼠标的样式 62 // dataLabels:{ 63 // enabled :true,//是否在点的旁边显示数据 64 // rotation:0 65 // }, 66 // enableMouseTracking:true,//鼠标移到图表上时是否显示提示框 67 // events:{//监听点的鼠标事件 68 // click: function() {} 69 // }, 70 // marker:{ 71 // enabled:true,//是否显示点 72 // radius:3,//点的半径 73 // fillColor:"#888" 74 // lineColor:"#000" 75 // symbol: 'url(http://highcharts.com/demo/gfx/sun.png)',//设置点用图片来显示 76 // states:{ 77 // hover:{ 78 // enabled:true//鼠标放上去点是否放大 79 // }, 80 // select:{ 81 // enabled:false//控制鼠标选中点时候的状态 82 // } 83 // } 84 // }, 85 // states:{ 86 // hover:{ 87 // enabled:true,//鼠标放上去线的状态控制 88 // lineWidth:3 89 // } 90 // }, 91 // stickyTracking:true,//跟踪 92 // visible:true, 93 // lineWidth:2//线条粗细 94 // pointStart:100, 95 // } 96 //}, 97 98 title: { 99 text: 'Monthly Average Temperature',//标题 100 x: -20 //center设置标题的位置 101 }, 102 103 subtitle: { 104 text: 'Source: WorldClimate.com',//副标题 105 x: -20//副标题位置 106 }, 107 108 xAxis: {//横轴的数据 109 categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 110 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], 111 //lineWidth:1,//纵轴一直为空所对应的轴,即X轴 112 //plotLines: [{//一条竖线 113 // color: '#FF0000', 114 // width: 2, 115 // value: 5.5 116 //}] 117 //labels: {//设置横轴坐标的显示样式 118 // rotation: -45,//倾斜度 119 // align: 'right', 120 // style: { 121 // font: 'normal 13px Verdana, sans-serif' 122 // color: 'white' 123 // } 124 //} 125 126 }, 127 128 yAxis: { 129 //tickInterval: 200, //自定义刻度 130 //max:1000,//纵轴的最大值 131 //min: 0,//纵轴的最小值 132 title: {//纵轴标题 133 text: '百分数' 134 }, 135 labels : { 136 formatter : function() {//设置纵坐标值的样式 137 return this.value + '%'; 138 } 139 }, 140 plotLines: [{ 141 value: 0, 142 width: 1, 143 color: '#808080' 144 }] 145 }, 146 147 tooltip: {//鼠标移到图形上时显示的提示框 148 formatter: function() { 149 return '<b>'+ this.series.name +'</b><br/>'+ 150 this.x +': '+ this.y +'°C'; 151 } 152 //crosshairs:[{//控制十字线 153 // width:1, 154 // color:"#CCC", 155 // dashStyle:"longdash" 156 //} 157 }, 158 159 legend: {//方框所在的位置(不知道怎么表达) 160 layout: 'vertical', 161 align: 'right', 162 verticalAlign: 'top', 163 x: -10, 164 y: 100, 165 borderWidth: 0 166 }, 167 168 series: [{//以下为纵轴数据 169 name: 'Tokyo', 170 data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6] 171 }, { 172 name: 'New York', 173 data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5] 174 }, { 175 name: 'Berlin', 176 data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0] 177 }, { 178 name: 'London', 179 data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8] 180 }] 181 }) 182 }) 183 </script> 184 </body> 185</html>

【属性说明】

一、chart的部分属性说明

1renderTo: 'container', //图表的页面显示容器(也就是要显示到的div) 2defaultSeriesType: 'line', //图表类型(line、spline、scatter、splinearea、bar、pie、area、column) 3marginRight: 50, //上下左右空隙(图表跟图框之间) 4marginBottom: 60, //下面空隙如果不够大,图例说明有可能看不到 5plotBackgroundImage: '../graphics/skies.jpg', //(图表的)背景图片 6plotBackgroundColor: //背景颜色 7width: 1000, //图框(最外层)宽(默认800) 8height: 500, //图框高(默认500) 9backgroundColor: "red" //图框的背景颜色 10borderColor: "red" //图框的边框颜色 11borderRadius: 5, //图框的圆角大小 12borderWidth: 9, //图框的边框大小 13inverted: false, //(使图)倒置 14plotBorderColor: "red", //图表的边框颜色 15plotBorderWidth: 0, //图表的边框大小 16plotShadow: false, //图表是否使用阴影效果 17reflow: false, 18shadow:true //图框是否使用阴影 19showAxes: false, //是否最初显示轴 20spacingTop: 100, //图表上方的空白 21spacingRight: 10, 22spacingBottom: 15, 23spacingLeft: 10, 24colors: [...] //图上线。。的颜色

二、credits的部分相关属性说明

1credits:{//设置右下角的标记。highchart.com (这个也可以在highcharts.js里中修改) 2 //enabled: true, //是否显示 3 position: { //显示的位置 4 align: 'left', 5 x: 10 6 }, 7 text: "xoyo.com", //显示的文字 8 style:{ //样式 9 cursor: 'pointer', 10 color: 'red', 11 fontSize: '20px' 12 }, 13 href: 'http://www.xoyo.com', //路径 14},

三、title的部分相关属性说明

1title:{//标题 2 text: '月份平均温度', 3 x: -20, //center //水平偏移量 4 y: 100 //y:垂直偏移量 5 align: 'right' //水平方向(left, right, bottom, top) 6 floating: true, //是否浮动显示 7 margin: 15, 8 style: , //样式 9 verticalAlign: "left" //垂直方向(left, right, bottom, top) 10},

四、xAxis或者YAxis

1          categories: ['一月', '二月'], 2 //allowDecimals: false 3 //alternateGridColor: 'red' //在图表中相隔出现纵向的颜色格栅 4 //dateTimeLabelFormats: , 5 //endOnTick: false, //是否显示控制轴末端的一个cagegories出来 6 //events: { 7 //setExtremes: 8 //}, 9 //gridLineColor: "red", //纵向格线的颜色 10 //gridLineDashStyle: Solid //纵向格栅线条的类型 11 //gridLineWidth: 5, //纵向格线的的大小 12 //id: null, 13 //labels: { //X轴的标签(下面的说明) 14 //align: "center", //位置 15 //enabled: false, //是否显示 16 //formatter: , 17 //rotation: 90, //旋转,效果就是影响标签的显示方向 18 //staggerLines: 4, //标签的交错显示(上、下) 19 //step: 2, //标签的相隔显示的步长 20 //style:{}, 21 //x: 100, //偏移量,默认两个都是0, 22 //y: 40 23 //}, 24 //lineColor: "red", //X轴的颜色 25 //lineWidth: 5, //X轴的宽度 26 //linkedTo:1, 27 //opposite: true //是否把标签显示到对面 28 //max: 12, //显示的最大值 29 //maxPadding: 6, 30 //maxZoom: 1, 31 //min: 10, //显示的最小值 32 //minorGridLineColor: 'red', //副格线的颜色 33 //minorGridLineDashStyle: 'blod', //副格线的的颜色 34 //minorGridLineWidth: 50, //副格线的宽度 35 //minorTickColor: #A0A0A0, //???没有看出效果 36 minorTickInterval:3, //副标记的间隔 37 //minorTickLength: 10, //副标记的长度 38 //minorTickPosition: 'inside', //副标记的位置 39 //minorTickWidth: 5, //副标记的宽 40 //minPadding: 0.01, 41 //offset: 0, //坐标轴跟图的距离 42 //plotBands: //使某数据块显示不同的效果 43 //plotLines: [{ //标线属性 44 //value: 0, //值为0的标线 45 //}], 46 //tickmarkPlacement: "on", //标记(文字)显示的位置,on表示在正对位置上。 47 //reversed: true, //是否倒置 48 //showFirstLabel: false, //第一个标记的数值是否显示 49 //startOfWeek: 2, 50 //tickColor: 'blue', //标记(坐标的记号)的颜色 51 //tickInterval: 20, //标记(坐标的记号)的步长 52 //tickLength: 5, 53 //tickmarkPlacement: "on", 54 //tickPixelInterval: 1000, //两坐标之间的宽度 55 //tickPosition: "inside", //坐标标记的方向 56 //title: { //设置坐标标题的相关属性 57 //margin: 40, 58 //rotation: 90, 59 //text: "Y-values", 60 //align: "middle", 61 //enabled: "middle", 62 //style: {color: 'red'} 63 //}, 64 //type: "linear"

五、tooltip的部分相关属性说明

1          tooltip: {//提示框设置 2 formatter: function() { //格式化提示框的内容样式 3 return '<b>'+ this.series.name +'</b><br/>'+ 4 this.x +': '+ this.y +'°C'; 5 }, 6 backgroundColor: '#CCCCCC', //背景颜色 7 //borderColor: '#FCFFC5' //边框颜色 8 //borderRadius: 2 //边框的圆角大小 9 borderWidth: 3, //边框宽度(大小) 10 //enabled: false, //是否显示提示框 11 //shadow: false, //提示框是否应用阴影 ?没有看出明显效果????????? 12 //shared: true, //当打开这个属性,鼠标几个某一区域的时候,如果有多条线,所有的线上的据点都会有响应(ipad) 13 //snap: 0, //没有看出明显效果????????? 14 crosshairs: { //交叉点是否显示的一条纵线 15 width: 2, 16 color: 'gray', 17 dashStyle: 'shortdot' 18 } 19 style: { //提示框内容的样式 20 color: 'white', 21 padding: '10px', //内边距 (这个会常用到) 22 fontSize: '9pt', 23 } 24 },

六、legend(图例说明)的部分相关属性说明

1          legend:{//图例说明 2 //layout: 'vertical', //图例说明布局(垂直显示,默认横向显示) 3 align: 'center', //图例说明的显示位置 4 //verticalAlign: 'top', //纵向的位置 5 //x: 250, //偏移量 6 //y: 0, 7 borderWidth: 1, //边框宽度 8 //backgroundColor: 'red' //背景颜色 9 borderColor: 'red', 10 //borderRadius //边框圆角 11 //enabled: false //是否显示图例说明 12 //floating:true //是否浮动显示(效果就是会不会显示到图中) 13 //itemHiddenStyle: {color: 'red'}, 14 //itemHoverStyle: {color: 'red'} //鼠标放到某一图例说明上,文字颜色的变化颜色 15 //itemStyle: {color: 'red'} //图例说明的样式 16 //itemWidth: //图例说明的宽度 17 //labelFormatter: function() { return this.value} //?????????????默认(return this.name) 18 //lineHeight: 1000 //没看出明显效果 19 //margin: 20 20 //reversed:true //图例说明的顺序(是否反向) 21 //shadow:true //阴影 22 //style: {color:'black'} 23 //symbolPadding: 100 //标志(线)跟文字的距离 24 //symbolWidth: 100 //标志的宽 25 //width:100 26 },

七、plotOptions的部分相关属性说明

1           plotOptions:{ //柱形图相关的 2 column: {//柱形图 3 //pointPadding: 0.2, 4 //borderWidth: 1, //柱子边框的大小 5 //borderColor: "red", //柱子边框的颜色 6 //borderRadius: 180, //柱子两端的圆角的半径 7 //colorByPoint: true, //否应该接受每系列的一种颜色或每点一种颜色 8 groupPadding: 0, //每一组柱子之间的间隔(会影响到柱子的大小) 9 //minPointLength: 0, //最小数据值那一条柱子的长度(如果是0,可能看不到,可以设置出来) 10 //pointPadding: 0.1, //柱子之间的间隔(会影响到柱子的大小) 11 //pointWidth: 2, //柱子的大小(会影响到柱子的大小) 12 //allowPointSelect: false, 13 //animation: true, //图形出来时候的动画 14 //color: 'red', //柱子的颜色 15 //connectNulls: false, //连接图表是否忽略零点(如线形图,数据为0是是否忽略) 16 //cursor: '', //?????????游标 17 //dashStyle: null, 18 dataLabels: { //图上是否显示数据标签 19 //enabled: true, 20 align: "center", 21 //color: 'red', 22 formatter: function() 23 { 24 return this.y + 'mm' 25 }, 26 rotation: 270, 27 //staggerLines: 0, 28 //step: , 29 //style: , 30 //x: 0, 31 //y: -6 32 }, 33 //enableMouseTracking: 34 events: { //事件 35 click: function(event) 36 { 37 alert(this.name); 38 }, 39 //checkboxClick: , 40 //hide: , 41 //legendItemClick: , 42 //mouseOver: , 43 //mouseOut: , 44 //show: 45 }, 46 //id: null, 47 //lineWidth: 20, 48 //marker: { //图例说明上的标志 49 //enabled: false 50 //}, 51 point: { //图上的数据点(这个在线形图可能就直观) 52 events: { 53 click: function() 54 { 55 alert(this.y); 56 }, 57 //mouseOver: , 58 //mouseOut: , 59 //remove: , 60 //select: , 61 //unselect: , 62 //update: 63 } 64 }, 65 //pointStart: 0, //显示图数据点开始值 66 //pointInterval: 1, //显示图数据点的间隔 67 //selected: false, 68 //shadow: true, 69 //showCheckbox: true, //是否显示(图例说明的)复选框 70 //showInLegend: false, //是否显示图例说明 71 //stacking: 'percent', //是否堆积??? 72 states:{ 73 hover:{ 74 //brightness: 0.1, 75 enabled: true, //图上的数据点标志是否显示 76 //lineWidth: 2, //没看出效果 77 marker: { 78 //states: , 79 //enabled: true, //数据点标志是否显示 80 //fillColor: null, //数据点标志填充的颜色 81 //lineColor: "#FFFFFF", //数据点标志线的颜色 82 //lineWidth: 0, //数据点标志线的大小 83 //radius: 45, //数据点标志半径 84 //symbol: 'triangle'//'url(http://highcharts.com/demo/gfx/sun.png)' //数据点标志形状(triangle三角形,或者用图片等等) 85 } 86 } 87 } 88 }, 89 //stickyTracking: true, //轨道粘性 (例如线图,如果这个设置为否定,那就必须点到数据点才有反应) 90 //visible: true, //设置为false就不显示图 91 //zIndex: null //没有看出效果??? 92 },
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )

Java爬虫之JSoup使用教程

title:Java爬虫之JSoup使用教程date:201812248:00:000800update:201812248:00:000800author:mecover:https://imgblog.csdnimg.cn/20181224144920712(https://www.oschin