我正在使用莫里斯图表。在 x 轴上我显示了一个日期。除了标签,一切都很好。我想像 x 轴格式一样显示我的标签。如何将绿色圆圈的值格式更改为红色圆圈的值格式?
$(function() {
"use strict";
var monthNames = [ "Oca", "Şub", "Mar", "Nis", "May", "Haz","Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara" ];
// LINE CHART
var line = new Morris.Line({
element: 'kelime-gecmisi',
resize: true,
data: [
{tarih: '2014-07-05', sira: 30},
{tarih: '2014-07-06', sira: 25},
{tarih: '2014-07-07', sira: 19},
{tarih: '2014-07-08', sira: 17},
{tarih: '2014-07-09', sira: 11},
{tarih: '2014-07-10', sira: 8},
{tarih: '2014-07-11', sira: 4},
{tarih: '2014-07-12', sira: 1},
// {tarih: '2014-07-13', item1: 1/3},
// {tarih: '2014-07-14', item1: 1/4},
// {tarih: '2014-07-15', item1: 1/9}
],
xkey: 'tarih',
ykeys: ['sira'],
xLabels:'day',
// continuousLine:false,
labels: ['Sıra'],
lineWidth: 2,
lineColors: ['#00A65A'],
hideHover: 'auto',
ymin:'auto 1',
ymax:'auto 30',
gridIntegers: true,
xLabelFormat: function(d) {
return d.getDate()+' '+monthNames[d.getMonth()]+' '+d.getFullYear();
},
//yLabelFormat: function(y) { if (y === 0) return 30; else return Math.round(1/y); }
});
});
最佳答案
答案在这里 https://stackoverflow.com/a/19886777/1449779
hoverCallback 而不是//yLabelFormat 也适用于折线图 http://jsbin.com/UJUkosa/199/edit
关于javascript - 莫里斯图 - 如何格式化悬停标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24747099/