Fixed chart displaying when no much value.

This commit is contained in:
Alexis Lahouze 2013-01-30 13:04:01 +01:00
parent 43c4e1f61d
commit 59ab18ad74

View File

@ -483,10 +483,11 @@ var ListViewModel = function() {
drawChart = function(data, element) { drawChart = function(data, element) {
// Clear previous chart // Clear previous chart
$(element).html(""); $(element).html("");
element.style.height="0px";
var entries = data.entries; var entries = data.entries;
if(entries && entries.length > 0) { if(entries && entries.length > 2) {
// Prepare for today vertical line. // Prepare for today vertical line.
var today = new Date(); var today = new Date();
today.setHours(0); today.setHours(0);
@ -583,8 +584,9 @@ drawChart = function(data, element) {
drawPieChart = function(entries, element) { drawPieChart = function(entries, element) {
// Clear previous chart // Clear previous chart
$(element).html(""); $(element).html("");
element.style.height="0px";
if(entries && entries.length > 0) { if(entries && entries.length > 2) {
// Plot chart, and store it in a window parameter for resize callback (need to be done better than it...) // Plot chart, and store it in a window parameter for resize callback (need to be done better than it...)
window.pieChart = $.jqplot(element.id, [entries], { window.pieChart = $.jqplot(element.id, [entries], {
// Title of the chart // Title of the chart