autoscale and format x axis in dimple.js
NickName:Javier Cárdenas Ask DateTime:2014-08-08T00:39:55

autoscale and format x axis in dimple.js

I would like a chart that autoscales the x axis according to the data size and shows only specific numbers, and for the rest of data points only show the tick lines without numbers. Something like this:

x-axis

In this example the length of the data is between 75 and 155, so it shows the numbers multiple of 20. Then for each interval there are 5 equally spaced tick lines.

Until now I've been able to edit the ticks with the cleanAxis function suggested here: How do you reduce the number of Y-axis ticks in dimple.js?. I did something like this for scaling the axis:

    if (data.length < 10) {
        cleanAxis(myAxis, 2);
    }
    if (data.length >= 10 && data.length < 75) {
        cleanAxis(myAxis, 10);
    }
    if (data.length >= 75 && data.length < 155) {
        cleanAxis(myAxis, 20);
    }
    if (data.length >= 155) {
        cleanAxis(myAxis, 50);
    }

This shows the number the way I want but also erased the ticks lines. Is it possible to do what I want in dimple.js?

Copyright Notice:Content Author:「Javier Cárdenas」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/25187816/autoscale-and-format-x-axis-in-dimple-js

More about “autoscale and format x axis in dimple.js” related questions

autoscale and format x axis in dimple.js

I would like a chart that autoscales the x axis according to the data size and shows only specific numbers, and for the rest of data points only show the tick lines without numbers. Something like ...

Show Detail

Change x-axis Interval Display - dimple.js

I am working on creating a bubble chart using dimple.js. I am currently using the addCategoryAxis() function of create my x-axis based on the data I am using. The problem is that there are too many

Show Detail

axis orient / position with dimple.js

Is there a way to explicitly position/orient an axis using dimple.js? I know that the first x-axis is added to the bottom and the second is added to the top, so I can get the desired outcome like t...

Show Detail

Fixing x axis scale and autoscale y axis

I would like to plot only part of the array, fixing the x part, but letting the y part autoscale. I tried as shown below, but it does not work. Any suggestions? import numpy as np import matplotlib.

Show Detail

Dimple.js change axis units format

I have charts using dimple.js to show frequencies of objects. Some of them are thousands of objects and instead of showing 20,000 it shows 20k. This is no good for me at all, is it possible to chan...

Show Detail

Matplotlib - fixing x axis scale and autoscale y axis

I would like to plot only part of the array, fixing x part, but letting y part autoscale. I tried as shown below, but it does not work. Any suggestions? import numpy as np import matplotlib.pyplot...

Show Detail

Matplotlib - fixing x axis scale and autoscale y axis

I would like to plot only part of the array, fixing x part, but letting y part autoscale. I tried as shown below, but it does not work. Any suggestions? import numpy as np import matplotlib.pyplot...

Show Detail

Dimple.js Axis Labels

I have a dataset where each row has an id and a name property. The id property is the unique key, the names may be duplicated. I want the name to be shown on the category axis of a Dimple.js chart....

Show Detail

Dimple.js how to customize range of values on Y-axis from 0 to 100?

I need to customize the y-axis value range to start from 0 till 100. I do not want the automated range that Dimple.js adds based on the data that I have. Please suggest if its possible. I tried the x.

Show Detail

Highcharts - format date for x-axis as well as autoscale (data from mysql)

I have done quite a bit of research and I am unsure what I am missing. I have a chart that is constructed from a mysql database and I have a date being pulled in to be displayed on the x-axis. Ho...

Show Detail