0

I was playing around with the waterfall series of the jqxChart.

According to its API, the following piece of code defines the values of the axis, in this case it's the y-axis:

valueAxis:
{
    title: {text: 'Population<br>'},
    unitInterval: 1000000,
    labels:
    {
        formatFunction: function (value) {
            return value / 1000000 + ' M';
        }
    }
}

Is it possible to define the intervals not with absolute values, but with relative values. So that the interval are e.g. 10% and the overall value is 100%?

Simply doing unitInterval: '10%' doesn't work.

This is how it should look like:

enter image description here

Here is a fiddle.

Evgenij Reznik
  • 17,916
  • 39
  • 104
  • 181

1 Answers1

0

I think you're looking for these options :

logarithmicScale: true,
logarithmicScaleBase: 1.10,

Example:

valueAxis:
            {
                title: {text: 'Population<br>'},
                logarithmicScale: true,
                logarithmicScaleBase: 1.10,
                labels:
                {
                    formatFunction: function (value) {
                        return value / 1000000 + ' M';
                    }
                }
            },

Edit:

var accuracy = 2;
var first = data[0].population;
var last = data[data.length - 2].population;
var unit = (100 / last);

// convert raw data to differences
for (var i = 0; i < data.length - 2; i++)
    data[i].population = (data[i].population * unit).toFixed(accuracy);
Dylan Wijnen
  • 219
  • 3
  • 13
  • Thank you, but I really want the y-axis to have % in 10%-intervals. So: 10%, 20%, ... 100%. – Evgenij Reznik Jul 18 '16 at 14:56
  • @user1170330 Can you please elaborate, Maybe a visual representation of what you'd like the Y-Axis to look like. – Dylan Wijnen Jul 18 '16 at 15:03
  • I've actually been trying to find a percentage scaled chart so far not found one. Your best bet is to convert all of your values to a percentage. And have your labels show the numbers either by referencing another data source or multiplying the unit scale by its percentage. See edit – Dylan Wijnen Jul 18 '16 at 16:00