Replace values from a column for the highcharts integration/setup

Replace values from a column for the highcharts integration/setup

bfarkasbfarkas Posts: 181Questions: 48Answers: 0

Hi,
Working through a couple of setups for charts, inspired by the recent blog post.
How would one go about replacing values shown in the chart being pulled from the table. This could be useful for renaming, but also thinking of the general use case where there are empty cells, which in the current setup return count for "", so no label shows up on the chart, would want to replace this with none or empty or something along those lines.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736
    Answer ✓

    I think you are referring to this code from the first chart:

        // And map it to the format highcharts uses
        var countMap = $.map(counts, function (val, key) {
            return {
                name: key,
                y: val,
            };
        });
    

    Change name: key, to name: key ? key : "None", or whatever you would like the label to be.

    Kevin

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    So simple! I had been looking at key replacement setups in javascript which were not quite working and loads more complicated. Thanks!

This discussion has been closed.