プロパティ: wsOj.op.wscaseName
取得例:
結果: "oneColAtATime"
Chrome Win なら[Ctrl]+[Shift]+J、Macなら[command]+[option]+Jなどでコンソールを開き、 たとえば、ccchart.getWsById('hoge1').op.wscaseName と打ち込んでみてください。
コード内でwscaseNameをセットしている位置
※プラグイン作成時はこのwscaseNameを忘れないようにしてください。
※忘れると"_wscaseFnc_"+(new Date())という名前がつきます。
wscase: {
// WebSocketの受信パターン
/* e.g.
[
["2013", "2014", "2015", "2016", "2017"],
[ 435, 332, 524, 688, 774],
[ 600, 335, 584, 333, 457]
];*/
oneColAtATime: function (msg) {
//ここのthisは_wメソッド内のthat.wsuids[uid]
this.op.wscaseName = 'oneColAtATime';
// 一度に1列ずつ [["2013"],[435],[600]] といった配列で届く場合
// e.g. ws.on('message', ccchart.wscase.oneColAtAtime)
try { var msgs = JSON.parse(msg.data); } catch(e) { return }
if (typeof msgs === 'string') { //if(msgs === target.hbStr){
if (this.wsDbg)console.log('ws message type is bad, it is string : ' + msgs);
return;
}
var that = ccchart.ops[this.op.id];
if(that._wsThinout(this, this.wsThinOutInterval))return;//ws受信データを間引く
for (var i = 0; i < msgs.length; i++) {
if(!that.op.data[i])continue;
var rowTitle = that.op.data[i].shift(); // 先頭を行タイトルとして削除
that.op.data[i].push(msgs[i]); // WSで受け取ったデータを追記
if (that.op.data[i].length > that.maxWsColLen) {
that.op.data[i].shift(); // maxWsColLen列以上は削除
}
that.op.data[i].unshift(rowTitle); // 先頭へ行タイトルを戻す
}
if (that.type === 'pie') {
that.op.config.maxWsColLen = 1
}
that.ops[that.id]['s'] = (new Date).getTime(); //描画開始時間
//再起へ
ccchart.init(that.id, that.op, function () {
that.ops[that.id].e = (new Date).getTime(); //描画終了時間
});
}
}