From f612b5cbaf719e05ad0fcbdd46553cd9345bc646 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Thu, 15 May 2014 13:21:27 -0400
Subject: [PATCH] Merged #77 "A single quote in a chart label generates invalid JavaScript"
---
src/main/java/com/gitblit/wicket/charting/Flotr2PieChart.java | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/main/java/com/gitblit/wicket/charting/Flotr2PieChart.java b/src/main/java/com/gitblit/wicket/charting/Flotr2PieChart.java
index ea04db9..f537e26 100644
--- a/src/main/java/com/gitblit/wicket/charting/Flotr2PieChart.java
+++ b/src/main/java/com/gitblit/wicket/charting/Flotr2PieChart.java
@@ -35,11 +35,11 @@
@Override
protected void appendChart(StringBuilder sb) {
-
+
String dName = "data_" + dataName;
line(sb, "var selected_" + dataName + " = null;");
line(sb, MessageFormat.format("var {0} = Flotr.draw(document.getElementById(''{1}''),", dName, tagId));
-
+
// Add the data
line(sb, "[");
for (int i = 0; i < values.size(); i++) {
@@ -47,13 +47,13 @@
if(i > 0){
sb.append(",");
}
- line(sb, MessageFormat.format("'{'data : [ [0, {0}] ], label : ''{1}'', color: ''{2}'' '}'", Float.toString(value.value), value.name, StringUtils.getColor(value.name)));
+ line(sb, MessageFormat.format("'{'data : [ [0, {0}] ], label : \"{1}\", color: ''{2}'' '}'", Float.toString(value.value), value.name, StringUtils.getColor(value.name)));
}
line(sb, "]");
-
+
// Add the options
line(sb, ", {");
- line(sb, MessageFormat.format("title : ''{0}'',", title));
+ line(sb, MessageFormat.format("title : \"{0}\",", title));
line(sb, "fontSize : 2,");
line(sb, "pie : {");
line(sb, " show : true,");
@@ -90,7 +90,7 @@
line(sb, " outlineWidth: 0");
line(sb, "}");
line(sb, ", legend: {");
- if(showLegend){
+ if(showLegend){
line(sb, " show: true");
}
else {
@@ -98,15 +98,15 @@
}
line(sb, "}");
line(sb, "});");
-
+
if(clickUrl != null && clickUrl.isEmpty() == false){
line(sb, MessageFormat.format("Flotr.EventAdapter.observe(document.getElementById(''{0}''), ''flotr:click'', function (mouse, a, b, c) '{'", tagId));
line(sb, " window.location.href = \"" + clickUrl + "\" + selected_" + dataName + ";");
- line(sb, "});");
+ line(sb, "});");
}
-
-
-
+
+
+
}
}
--
Gitblit v1.9.1