Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
BZ-993528 - Support integer values in NVD3 charts
Browse files Browse the repository at this point in the history
  • Loading branch information
dgutierr committed Sep 6, 2013
1 parent 6399604 commit 3f26d3f
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 19 deletions.
Expand Up @@ -162,6 +162,6 @@ labelDomain.labelIntervalsOrder.ascendant=Asc
labelDomain.labelIntervalsOrder.descendant=Desc
abstractChartDisplayer.margin_top=Marge superior
abstractChartDisplayer.margin_bottom=Marge inferior
abstractChartDisplayer.showLinesArea=Mostrar u00E1reas
abstractChartDisplayer.showLinesArea=Pintar \u00E1rea
abstractChartDisplayer.margin_left=Marge esquerre
abstractChartDisplayer.margin_right=Marge dret
Expand Up @@ -48,7 +48,7 @@ abstractChartDisplayer.margin_top=Margen superior
abstractChartDisplayer.margin_bottom=Margen inferior
abstractChartDisplayer.margin_left=Margen izquierdo
abstractChartDisplayer.margin_right=Margen derecho
abstractChartDisplayer.showLinesArea=Mostrar u00E1reas
abstractChartDisplayer.showLinesArea=Pintar \u00E1rea
abstractDomain.description=Descripci\u00F3n
abstractDomain.finalInterval=Otros
abstractDomain.maxNumberOfIntervals=N\u00FAmero m\u00E1ximo de intervalos
Expand Down
Expand Up @@ -73,7 +73,7 @@ protected void init() {
featuresSupported.add(DataDisplayerFeature.ALIGN_CHART);
featuresSupported.add(DataDisplayerFeature.SHOW_TITLE);
featuresSupported.add(DataDisplayerFeature.SHOW_HIDE_LABELS);
//featuresSupported.add(DataDisplayerFeature.ROUND_TO_INTEGER);
featuresSupported.add(DataDisplayerFeature.ROUND_TO_INTEGER);
//featuresSupported.add(DataDisplayerFeature.SET_CHART_TYPE);
featuresSupported.add(DataDisplayerFeature.SET_CHART_WIDTH);
featuresSupported.add(DataDisplayerFeature.SET_CHART_HEIGHT);
Expand Down
Expand Up @@ -15,6 +15,10 @@
limitations under the License.

--%>
<%
int decimalPrecision = 2;
if (displayer.isAxisInteger()) decimalPrecision = 0;
%>
<script type="text/javascript" defer="defer">
chartData<%=chartId%> = [
{
Expand Down Expand Up @@ -50,6 +54,7 @@
});

chart.yAxis
.tickFormat(d3.format(',.<%=decimalPrecision%>f'))
.axisLabel("<%= rangeProperty.getName(locale) %>");

chart.xAxis
Expand Down Expand Up @@ -77,7 +82,7 @@
<% } %>

graph.dispatch.on('tooltipShow', function(e, offsetElement) {
x = graph.xAxis.tickFormat()(graph.discretebar.x()(e.point, e.pointIndex)),
x = e.point.label;
y = graph.yAxis.tickFormat()(graph.discretebar.y()(e.point, e.pointIndex)),
content = x + " : " + y;

Expand Down
Expand Up @@ -15,6 +15,10 @@
limitations under the License.

--%>
<%
int decimalPrecision = 2;
if (displayer.isAxisInteger()) decimalPrecision = 0;
%>
<script type="text/javascript" defer="defer">
chartData<%=chartId%> = [
{
Expand Down Expand Up @@ -56,6 +60,7 @@
});

chart.yAxis
.tickFormat(d3.format(',.<%=decimalPrecision%>f'))
.axisLabel("<%= rangeProperty.getName(locale) %>");

chart.xAxis
Expand Down Expand Up @@ -87,18 +92,18 @@
<% } %>

graph.dispatch.on('tooltipShow', function(e, offsetElement) {
x = graph.xAxis.tickFormat()(graph.lines.x()(e.point, e.pointIndex));
y = graph.yAxis.tickFormat()(graph.lines.y()(e.point, e.pointIndex));
n = e.pointIndex;

if( n >= 0 && n < <%=xvalues.size()%> ) {
content = chartLabels<%=chartId%>[n] + " : " + y;
} else {
content = "";
}

document.getElementById("tooltip<%=chartId%>").innerHTML=content;
});
x = e.point.label;
y = graph.yAxis.tickFormat()(graph.lines.y()(e.point, e.pointIndex));
n = e.pointIndex;

if( n >= 0 && n < <%=xvalues.size()%> ) {
content = chartLabels<%=chartId%>[n] + " : " + y;
} else {
content = "";
}

document.getElementById("tooltip<%=chartId%>").innerHTML=content;
});
}
});
</script>
Expand Up @@ -15,6 +15,10 @@
limitations under the License.

--%>
<%
int decimalPrecision = 2;
if (displayer.isAxisInteger()) decimalPrecision = 0;
%>
<script type="text/javascript" defer="defer">
chartData<%=chartId%> = [
{
Expand Down Expand Up @@ -63,9 +67,13 @@

graph.dispatch.on('tooltipShow', function(e, offsetElement) {
<% if(enableTooltips) { %>
content = e.label + " : " + e.value;
document.getElementById("tooltip<%=chartId%>").innerHTML=content;
<% } %>
x = e.label;
y = d3.format(',.<%=decimalPrecision%>f')(e.value);

content = x + " : " + y;
document.getElementById("tooltip<%=chartId%>").innerHTML=content;

<% } %>
});
}
});
Expand Down

0 comments on commit 3f26d3f

Please sign in to comment.