Here's a jsFiddle to replicate the problem based on the simple example from the dimple home page (in this example chart is on tab 2):
function drawDimpleChart(){
var svg = dimple.newSvg("#tabs-2", 800, 600);
var data = [
{ "Word":"Hello", "Awesomeness":2000 },
{ "Word":"World", "Awesomeness":3000 }
];
var chart = new dimple.chart(svg, data);
chart.addCategoryAxis("x", "Word");
chart.addMeasureAxis("y", "Awesomeness");
chart.addSeries(null, dimple.plot.bar);
chart.draw();
}
$(document).ready(function() {
$("#tabs").tabs();
drawDimpleChart();
});
The problem is related to the issue here:
https://github.com/PMSI-AlignAlytics/dimple/issues/34
Dimple does a lot of measuring on the SVG and this isn't possible when the div (and therefore the svg) is hidden. In browsers other than firefox, label alignment goes wrong, but firefox throws the NS_ERROR_FAILURE error.
The solution is to draw to a visible div and immediately move it into the hidden div when drawing completes. You can see it working in this fiddle:
function drawDimpleChart(){
var svg = dimple.newSvg("#chartTab", 600, 400);
var data = [
{ "Word":"Hello", "Awesomeness":2000 },
{ "Word":"World", "Awesomeness":3000 }
];
var chart = new dimple.chart(svg, data);
chart.addCategoryAxis("x", "Word");
chart.addMeasureAxis("y", "Awesomeness");
chart.addSeries(null, dimple.plot.bar);
chart.draw();
$("#chartTab").appendTo("#tabs-2");
}
$(document).ready(function() {
$("#tabs").tabs();
drawDimpleChart();
});
I hope this helps.
John