1
flot을 사용하여 매일 내 응용 프로그램이 가져 오는 검색 결과의 수를 보여주는 차트를 만들려고합니다. 내 코드 (BTW이 사용 underscore.js) :이 같은flot 날짜 막대 차트 정렬 비스듬히
flotDataSet = _.countBy(resultSet, function(file) {
var exactDate = new Date(parseInt(file.get('start_utc'), 10));
//constructing a new date with 0 time so that all days get grouped together.
return new Date(exactDate.getUTCFullYear(), exactDate.getUTCMonth(), exactDate.getUTCDate()).getTime();
});
flotDataSet = _.map(flotDataSet, function(value, key) {
return [key, value];
});
$.plot(
$graphDiv,
[{
data: flotDataSet,
color: '#012D4C',
bars: { show: true, fillColor: '#024985', align: 'center', fill: 0.7, barWidth: DateUtil.msInDay/2 }
}],
{
grid: { color: '#012D4C' },
xaxis: {
mode: 'time',
tickSize: [1, 'day'],
autoscaleMargin: 0.001
}
}
);
출력 뭔가 :
정말 일 중심으로하는 바이 필요합니다. 이견있는 사람? 감사!
jsFiddle : http://jsfiddle.net/bUa3R/ – CullenJ
이상합니다. 내 jsFiddle에서 작동하지만 내 웹 앱에서는 작동하지 않습니다. – CullenJ