Skip to content

Commit

Permalink
Show charts only if there is > 1 stat points
Browse files Browse the repository at this point in the history
  • Loading branch information
fancoder committed Aug 12, 2014
1 parent 92ec67f commit 62731f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions website/custom.css
Expand Up @@ -221,6 +221,11 @@ footer {
.chartsPoolStat {
padding-top: 30px;
}

.chartWrap {
display: none;
}

.userChart .chart,
.chartWrap .chart {
margin-bottom: 10px;
Expand Down
16 changes: 8 additions & 8 deletions website/pages/home.html
Expand Up @@ -170,7 +170,7 @@ <h4>Workers</h4>
tooltipValueLookups: {
names: null
}
}
};

var userGraphStat = {
type: 'line',
Expand Down Expand Up @@ -210,7 +210,7 @@ <h4>Workers</h4>
tooltipValueLookups: {
names: null
}
}
};

$(function() {
$('[data-toggle="tooltip"]').tooltip();
Expand Down Expand Up @@ -669,12 +669,14 @@ <h4 class="yourStats">Payments</h4>
};

for(var graphType in graphData) {
if(graphData.hasOwnProperty(graphType)) {
if(graphData[graphType].values.length > 1) {
currencyGraphStat.tooltipValueLookups.names = graphData[graphType].names;
$('[data-chart=' + graphType + '] .chart').sparkline(graphData[graphType].values, currencyGraphStat);
var $chart = $('[data-chart=' + graphType + '] .chart');
$chart.closest('.chartWrap').show();
$chart.sparkline(graphData[graphType].values, currencyGraphStat);
}
}
}
}
}

function loadStatistics () {
Expand Down Expand Up @@ -726,9 +728,7 @@ <h4 class="yourStats">Payments</h4>
xhrRenderCharts = $.ajax({
url: api + '/stats',
cache: false,
success: function(data) {
createCharts(data);
}
success: createCharts
});
});

Expand Down

0 comments on commit 62731f7

Please sign in to comment.