leftAxisWidth = 0,
leftAxisLabels = opts.leftaxislabels || [];
leftAxisFontSize = opts.leftaxisfontsize || 16,
+ rightPadding = 50;
bottomAxisHeight = 0,
bottomAxisStep = opts.bottomaxisstep || 10;
bottomAxisFontSize = opts.bottomaxisfontsize || 16,
}
}
+ var step = max / bottomAxisStep;
+ var factor = 1;
+
+ if(step > 10) {
+ if(step % 10 != 0) {
+ factor = 10;
+ }
+ }
+
+ max = Math.ceil(step / factor) * factor * bottomAxisStep;
+
// background
paper.rect(0, 0, width, height).attr({ stroke: "none", fill: background });
- var barWidth = (width - leftAxisWidth); // maximum width of bar
+ var barWidth = (width - leftAxisWidth - rightPadding); // maximum width of bar
var barHeight = (height - bottomAxisHeight) / (len * (100 + gutter) + gutter) * 100;
var barGutter = barHeight * (gutter / 100);
paper,
leftAxisWidth,
height - bottomAxisHeight,
- width - leftAxisWidth,
+ barWidth,
max,
bottomAxisStep,
bottomAxisHeight,
MHBarchart.prototype.bottomAxis = function (paper, x, y, length, max, steps, axisHeight, axisFont, axisFontSize, axisFontWeight, axisFontColor)
{
+
var path = ["M", x, y, "l", length, 0],
text = paper.set(),
d = Math.ceil(max / steps),
dl = length / steps;
- for(var i = 0; i < steps; i++) {
+ for(var i = 0; i <= steps; i++) {
paper.text(x + i * dl, y + axisHeight / 2, i * d).attr({
"font-size": axisFontSize,
"font-family": axisFont,