| | |
| | | |
| | | @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++) { |
| | |
| | | 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,"); |
| | |
| | | line(sb, " outlineWidth: 0"); |
| | | line(sb, "}"); |
| | | line(sb, ", legend: {"); |
| | | if(showLegend){ |
| | | if(showLegend){ |
| | | line(sb, " show: true"); |
| | | } |
| | | else { |
| | |
| | | } |
| | | 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, "});"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |