Search code examples
d3.jsresponsive-designdimple.js

Prevent dimple from renaming columns on redraw


I renamed my column names as explained here: dimple.js How can I change the labels of a chart axis without changing the data?

The problem is that the column names change back to default on redraw. I redraw on page resize with parameter noDataChange = true as shown in this example: http://dimplejs.org/advanced_examples_viewer.html?id=advanced_responsive_sizing

Any ideas on how to prevent reverting column names to default?

EDIT:

So far I've tried to rename the axes again on each resize, but they seem to change for a short period of time (during debugging) and then turn back to the column name in the data. What causes the axes' names to change on draw?


Solution

  • My answer on the linked question is out of date, in more recent versions of dimple the alternate answer is now the preferred way to do it.

    Set the title before drawing:

    ...
    x = chart.addCategoryAxis("x", "My Dimension");
    x.title = "My Awesome New Title";
    chart.draw();