0
私はMorris.js折れ線グラフに人間が読める日付を表示しようとしていますが、代わりにタイムスタンプを表示しています。私はhoverCallback
エリアに見えたが、変更内容が不明だしました:Morris.jsの人間の日付値ホバーコールバック
update_host_info.js.erb
new Morris.Line({
element: 'device_security_trend',
data: $('#device_security_trend').data('security-trend'),
smooth: false,
ymax: 'auto[99]',
xkey: 'created_at',
ykeys: ['security_percentage'],
labels: ['Security Percentage'],
postUnits: '%',
resize: true,
hoverCallback: function(index, options, content) {
return(content);
}
});
device_security_trend要素
<div data-security-trend="[{"created_at":"2016-02-23T13:28:05.160-04:00", "security_percentage" :0},{"created_at":"2016-02-23T16:24:56.128-04:00","security_percentage":99},{"created_at":"2016-02-23T16:24:57.560-04:00","security_percentage":0}" id="device_security_trend" style="width: 100%; position: relative; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);" class="selected"><div class="morris-hover-row-label">2016-02-23T13:28:05.160-04:00</div><div class="morris-hover-point" style="color: #689bc3">
Security Percentage:
0%
</div></div>
右ちょうど変えてしまった
4/19/2016 - 9:30am
'#device_security_trend'要素の内容を表示する必要があります。 – Uzbekjon
あなたは@Uzbekjonに行く – Godzilla74
@Uzbekjonよく、私はちょうど最初の場所で日付形式を変更することについて考えています...だから、私はヘルパーで何をしたのですか。 – Godzilla74