Author: croberts
Date: 2011-12-02 16:07:10 +0000 (Fri, 02 Dec 2011)
New Revision: 5159
Modified:
branches/noflash/cumin/resources/app.js
Log:
More fine-tuning of the charts with respect to y-axis scaling and labels, especially with
smaller values.
Modified: branches/noflash/cumin/resources/app.js
===================================================================
--- branches/noflash/cumin/resources/app.js 2011-12-01 19:02:54 UTC (rev 5158)
+++ branches/noflash/cumin/resources/app.js 2011-12-02 16:07:10 UTC (rev 5159)
@@ -603,9 +603,10 @@
},
axes: {
y2axis: {
- autoscale: true,
+ autoscale:true,
min:0,
tickOptions:{formatString:'%.0f',formatter: y_axis_Formatter,},
+ pad:1.01,
numberTicks:4,
},
xaxis: {
@@ -655,7 +656,6 @@
for (i=0; i < dataContainer['labels'].length; i++) {
if(dataContainer['y_coordinate_values'][i].length == 0) {
dataContainer['y_coordinate_values'][i] = [1,0];
- needToReplot = false;
}
}
@@ -665,9 +665,7 @@
allCharts[divName].series[i].data =
dataContainer['y_coordinate_values'][i];
}
try {
- if(needToReplot) {
-
allCharts[divName].replot({resetAxes:(!allCharts[divName].plugins.cursor._zoom.isZoomed),
axes:{y2axis:{autoscale:true,min:0,numberTicks:4,tickOptions:{formatString:'%.0f',formatter:
y_axis_Formatter,}}, xaxis:{min:dataopts['xmin'] /
dataContainer['x_axis_normalizer'], max:dataopts['xmax'] /
dataContainer['x_axis_normalizer'],tickOptions:{formatString:'%.0f ' +
dataContainer['x_axis_unit_label'], formatter: x_axis_Formatter,}}}})
- }
+ allCharts[divName].replot({resetAxes:(!allCharts[divName].plugins.cursor._zoom.isZoomed),
axes:{y2axis:{autoscale:true,min:0,pad:1.01,numberTicks:4,tickOptions:{formatString:'%.0f',formatter:
y_axis_Formatter,}}, xaxis:{min:dataopts['xmin'] /
dataContainer['x_axis_normalizer'], max:dataopts['xmax'] /
dataContainer['x_axis_normalizer'],tickOptions:{formatString:'%.0f ' +
dataContainer['x_axis_unit_label'], formatter: x_axis_Formatter,}}}})
} catch (err) {
// this is needed in the event of the first draw for a fullpage chart
allCharts[divName] = $j.jqplot(holder,
dataContainer['y_coordinate_values'],chartOptionsObject);
@@ -701,11 +699,15 @@
if (val > 1000000) {
val = val / 1000000
format = "%.1fM";
- }
- if (val > 100000) {
+ } else if (val > 100000) {
val = val / 1000
format = "%.1fk";
- }
+ } else if (val < 2) {
+ format = "%.2f";
+ }
+ if (val == 0) {
+ format = "%d";
+ }
tickval = $j.jqplot.sprintf(format, val);
}
else {