Home Forums Chart Support How to use fixed Y axis 0-100%

# How to use fixed Y axis 0-100%

Viewing 9 posts - 1 through 9 (of 9 total)
• #14886

Hi, I have data that can be only 0 to 100. I would like the Y axis to always show 0-100 regardless of highest data point. Is this possible?

Thanks, Bill

#14889

@wep,

You can specify the minimum and maximum permitted values by setting minimum and maximum property of axisY to 0 and 100 respectively.

If this is not what you are looking for can you please create a jsfiddle so that we can look into your code and help you out better.
___
Suyash Singh
Team CanvasJS

#30394

i have data like:

dataPoints: [
{ x: 10, y: 150 },
{ x: 20, y: 400},
{ x: 30, y: 500 },
{ x: 40, y: 2000 },
{ x: 50, y: 814 },
{ x: 60, y: 68 },
{ x: 70, y: 28 },
{ x: 80, y: 34 },
{ x: 90, y: 14}
]

I want to show axisY to 100%. is there any solution.

#30419

Can you kindly brief us more about your scenario and what is the reference value for 100% (100% of what value) so that we can understand your requirement better and help you out?

—-
Manoj Mohan
Team CanvasJS

#30427

I want to Y value to counted as 100%.
Actually my Data looks like this:

``````dataPoints: [
{ x: new Date(), y: 150 },
{ x: new Date(), y: 400},
{ x: new Date(), y: 500 },
{ x: new Date(), y: 2000 },
]``````

`axisY: {
suffix: “%” // this should be calculated to 100% of Y values.
},`

#30469

Please take a look at this JSFiddle.

—-
Manoj Mohan
Team CanvasJS

#30509

Thanks. It Worked.

#30523

One more thing!!
What if i have More then 1 Line. how can i calculate 100% for Multi `data` (multiple objects as dataPoints).
in the blow data i have max point in 2 object and it can be in any object as it is multi line chart. how can i calculate in that scenario.

``````data: [
{
// Change type to "doughnut", "line", "splineArea", etc.
type: "spline",
dataPoints: [
{ x: 10, y: 150 },
{ x: 20, y: 400 },
{ x: 30, y: 500 },
{ x: 40, y: 2000 },
{ x: 50, y: 814 },
{ x: 60, y: 68 },
{ x: 70, y: 28 },
{ x: 80, y: 34 },
{ x: 90, y: 14 }
]
},
{
type: "spline",
dataPoints: [
{ x: 10, y: 150 },
{ x: 20, y: 400 },
{ x: 30, y: 800 },
{ x: 40, y: 1500 },
{ x: 50, y: 814 },
{ x: 60, y: 68 },
{ x: 70, y: 3000 },
{ x: 80, y: 34 },
{ x: 90, y: 14 }
]
}
]``````
• This reply was modified 3 years, 9 months ago by saqib.
#30525

Got the solution with some changes in for Loop.

`````` let a = [];
chart.options.data.forEach((val, i)=>{