我需要改变我的图表处理,我有这个
{"Modem_Signal_lte0":{"data":[["2017-08-03T07:55:35.000Z",53.1],["2017-08-03T08:00:35.000Z",52.58],["2017-08-03T08:05:35.000Z",52.83],["2017-08-03T08:10:35.000Z",53],["2017-08-03T08:15:35.000Z",53],["2017-08-03T08:20:35.000Z",53],["2017-08-03T08:25:35.000Z",53],["2017-08-03T08:30:35.000Z",54.42],["2017-08-03T08:35:35.000Z",53.05],["2017-08-03T08:40:35.000Z",54.78],["2017-08-03T08:45:35.000Z",55.43],["2017-08-03T08:50:35.000Z",58.55]],"options":{"labels":["Date","rssi"],"showRangeSelector":true,"legend":"always","ylabel":"dBm","title":"Modem Signal","axes":{"y":{}},"width":{}}},"Modem_Roaming_lte0":{"data":[["2017-08-03T07:56:45.000Z",0],["2017-08-03T08:01:45.000Z",0],["2017-08-03T08:06:45.000Z",0],["2017-08-03T08:11:45.000Z",0],["2017-08-03T08:16:45.000Z",0],["2017-08-03T08:21:45.000Z",0],["2017-08-03T08:26:45.000Z",0],["2017-08-03T08:31:45.000Z",0],["2017-08-03T08:36:45.000Z",0],["2017-08-03T08:41:45.000Z",0],["2017-08-03T08:46:45.000Z",0],["2017-08-03T08:51:45.000Z",0]],"options":{"labels":["Date","roaming"],"showRangeSelector":true,"legend":"always","ylabel":"","title":"Modem Roaming","axes":{"y":{}},"width":{}}},"Modem_Activity_lte0":{"data":[["2017-08-03T07:55:35.000Z",1],["2017-08-03T08:00:35.000Z",1],["2017-08-03T08:05:35.000Z",1],["2017-08-03T08:10:35.000Z",1],["2017-08-03T08:15:35.000Z",0.98],["2017-08-03T08:20:35.000Z",1],["2017-08-03T08:25:35.000Z",1],["2017-08-03T08:30:35.000Z",1],["2017-08-03T08:35:35.000Z",1],["2017-08-03T08:40:35.000Z",0.98],["2017-08-03T08:45:35.000Z",1],["2017-08-03T08:50:35.000Z",0.98]],"options":{"labels":["Date","state"],"showRangeSelector":true,"legend":"always","ylabel":"","title":"Modem Activity","axes":{"y":{}},"width":{}}},"Modem_Mode_lte0":{"data":[["2017-08-03T07:55:35.000Z",6],["2017-08-03T08:00:35.000Z",6],["2017-08-03T08:05:35.000Z",6],["2017-08-03T08:10:35.000Z",6],["2017-08-03T08:15:35.000Z",6],["2017-08-03T08:20:35.000Z",6],["2017-08-03T08:25:35.000Z",6],["2017-08-03T08:30:35.000Z",6],["2017-08-03T08:35:35.000Z",6],["2017-08-03T08:40:35.000Z",6],["2017-08-03T08:45:35.000Z",6],["2017-08-03T08:50:35.000Z",6]],"options":{"labels":["Date","Sysmode"],"showRangeSelector":true,"legend":"always","ylabel":"","title":"Modem Mode","axes":{"y":{"includeZero":true}},"width":{}}}}
然后它呈现四个图形"调制解调器活动","调制解调器模式","调制解调器漫游"和"调制解调器信号"。
我需要切换图形"调制解调器漫游"使用"调制解调器信号"。
怎么做?
我的观点:
<tab heading="Modems" select="changeTab()" disable="!tabClick" active="activeTab.modem">
<div class="no-data" ng-if="activeNoData.modem">
<img src="/assets/img/nodata.png"/>
<h3>No Data</h3>
</div>
<tabset class="box-tab box-tab-sub">
<tab ng-repeat="type in dataGraph.modem.types" heading="{{type.label}}" select="changeSubTab(type.type)" disable="!tabClick">
<p>{{dataGraph.modem[type.type]}}</p>
<div class="col-md-12" style="text-align:center;margin-bottom:30px" ng-repeat="graph in dataGraph.modem[type.type]">
<img ng-if="!graph.options" style="height:32px;margin:50px auto;" src="/assets/img/loader.gif" />
<div ng-if="graph.options">
<dygraph options='graph.options' data="graph.data"></dygraph><br>
</div>
</div>
</tab>
</tabset>
</tab>
答案 0 :(得分:0)
无法保证对象中的键序列。如果您关心序列,则需要将它们重组为数组。
var data = // data here
var dataArr = [];
dataArr.push(data.Modem_Activity_lte0);
dataArr.push(data.Modem_Mode_lte0);
dataArr.push(data.Modem_Roaming_lte0);
dataArr.push(data.Modem_Signal_lte0);