Home Forums Porto Admin Template Graphs (flotDashBasic) Scaling

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #10031018
    mushi
    Participant

    Hi Support,
    I want to scale my graph (both x axis and y axis), I sure can set the minimum and maximum range of y axis and x axis but i need to set the scale according to my requirement. I want to set the scale of x axis as 0 2 4 6 10 12 14 16 18 20 22 24(min 0, max 24), and for y axis i want to set the scale to 0 100 200 400 700 1100 to 6500 (min 0, max 6500).


    #10031019
    mushi
    Participant

    By using scale i meant Stepsize.


    #10031025
    Support2
    Keymaster

    Hello Mushi,

    You can use the option ticks for the yaxis and xaxis on the JS code that initializes the chart:

    (js/exmples/examples.charts.js):

    ....
    ...
    ..
    yaxis: {
    	min: 0,
    	max: 6500,
    	color: 'rgba(0,0,0,0.1)',
    	ticks: [[0, "0"], [100, "100"], [200, "200"], [400, "400"], [700, "700"], [1100, "1100"], [6500, "6500"]]
    },
    xaxis: {
    	min: 0,
    	max: 24,
    	color: 'rgba(0,0,0,0.1)',
    	ticks: [[0, "0"], [2, "2"], [4, "4"], [6, "6"], [10, "10"], [12, "12"], [14, "14"], [16, "16"], [18, "18"], [20, "20"], [22, "22"], [24, "24"]]
    },
    ...
    ...
    ..

    Please try that and let us know if you need further assistance.

    Kind Regards,

    Rodrigo.


    #10031029
    mushi
    Participant

    Thank you,It works. One more thing how can i label them (value of x axis and y axis)?


    #10031036
    Support2
    Keymaster

    Hello Mushi,

    You use html on values at ticks option. For example:

    ticks: [[0, "0"], [100, "100"], [200, "200"], [400, "400"], [700, "700"], [1100, "<div class='text-right'><strong class='d-block'>Label Here</strong> 1100</div>"], [6500, "6500"]]

    * Note the 1100 example. Do the same for all the others.
    * You can do the same for xaxis.

    Please try that and let us know if you need further assistance.

    Kind Regards,

    Rodrigo.


Viewing 5 posts - 1 through 5 (of 5 total)