//chart的数据格式,xChart中所有的图表数据格式都是这样的二维数组, //第一行是表头。 var data= [ ["xfield","uv" ,"pv","click","show"], [ 1 , 101 , 20 , 33 ,100], [ 2 , 67 , 51 , 26 ,35], [ 3 , 76 , 45 , 43 ,43], [ 4 , 58 , 35 , 31 ,345], [ 5 , 79 , 73 , 71 ,234], [ 6 , 88 , 54 , 39 ,423], [ 7 , 56 , 68 , 65 ,89], [ 8 , 99 , 83 , 51 ,88] ]; var options = { type : "horizontal", yAxis : { field : [ [ "uv" , "pv" ], ["click"] //[ "click" , "show" ] ], }, xAxis : { field : ["xfield"], }, graphs : { bar : { fillStyle : [ [ "#458ae6" , "#94cc5c" ], [ "#999999" , "#cccccc" ] ] } } } var chartx = Chartx.bar("canvasTest" , data , options); chartx.then(function( line ){ line.on( "mouseover" , function( e ){ eventHandler(e); } ); //mobile 触屏事件对应的为 //tap(点击), panstart(手势准备开始移动) ,panmove(手势移动中), panend(手势移动结束) }); var eventHandler = function( e ){ }
柱状图 - 横向有堆叠的柱状图
联系人:@逢春 @释剑