2016-02-05 71 views
2

我必须绘制30天数据的融合图。但由于数据点太多,滚动条即将到来。所以我只想绘制每一个第n个标签。为了减少我的X轴大小。如何在fusionCharts中显示每个第n个标签以处理长x轴标签?

融合图表代码是在这里:

var ecuChart = new FusionCharts({ 
        //type: 'mscolumn3d', 
        type: 'scrollline2d', 
        //type: 'msarea', 
        renderAt: 'ecuGraphBody', 
        width: "265", 
        height: "100%", 
        dataFormat: "json", 
        dataSource: { 
         "chart": { 
          "subcaption": "Graph", 
          "xAxisname": "day", 
          "yAxisName": " $/Hour", 
          "numvisibleplot": "24", 
          "animation":"1",       
          "decimals":"2", 
          "showLegend": "1", 
          "numberprefix": "$", 
          "legendPosition": "bottom", 
          "legendIconScale":"1", 
          "theme":"fint", 
          "legendshadow": "0", 
          "exportenabled": "1", 
          "legendborderalpha": "0", 
          //"palettecolors": "#f8bd19,#008ee4,#33bdda,#e44a00,#6baa01,#583e78", 
          "showborder": "0", 
          "showValues": "1", 
          "labelStep" :"4" 
         }, 

         "categories": [ 
             { 
              "category": categories 
             } 
            ], 
         "dataset": [ 
            { 
              "data": graphdata 
            } 
            ] 


        } 
       }).render(); 


graphdata: [ 
       { 
        "value": "15123" 
       }, 
       { 
        "value": "14233" 
       }, 
       { 
        "value": "23507" 
       }, 
       { 
        "value": "9110" 
       }, 
       { 
        "value": "15529" 
       }, 
       { 
        "value": "20803" 
       }, 
       { 
        "value": "19202" 
       } 
       . 
       . 
       . 
       ] 

categories : [ 
       { 
        "label": "1" 
       }, 
       { 
        "label": "2" 
       }, 
       { 
        "label": "3" 
       }, 
       { 
        "label": "4" 
       }, 
       { 
        "label": "5" 
       }, 
       { 
        "label": "6" 
       }, 
       { 
        "label": "7" 
       } 
       . 
       . 
       . 
       . 
       { 
        "label": "30" 
       }] 
+0

我认为最好过滤每个第n个数据然后将它传递给图表对象 – adiga

+0

使用'$ .grep'过滤图形数据和基于你想到的'n'的类别 – adiga

+0

@adiga with $ .grep有效。谢谢 – monica

回答

1

尝试属性labelStep和定义要多少标签跳过。你会从这里得到细节link

+0

我尝试过使用labelStep。它只会减少x轴上显示的标签数量,但不会减少绘制点的数量,因为我的x轴大小仍然相同。 – monica

+0

如果你不想显示标签和数据,你不应该在数据本身。无法确定要保留哪个数据点以及要跳过哪个数据点。希望这个帮助。如果你有一个单独的问题,空间或性能,大数据,然后让我知道。 – pallabB

+0

是的,我只使用过这种解决方案。在绘制数据之前,我根据我需要的点数解析它。谢谢 – monica