Sorry My Bad. I want this for axisX.
axisX
Thanks. Let me Take a look and try this if it works.
Here is the sample project Based on your Angular Example.
Github Repo
I am using it in my Angular Project. I downloaded CanvasJs Angular Example and it shows SAME Error even in your Angular Sample project. I am trying to make Working Example to share with you so you can track this bug.
CanvasJs
its Showing Error:
core.js:6014 ERROR TypeError: chart.toolTip.showAtX is not a function
showAtX() is not defined. i have tested in in stackblitz and its working but not in my Code.
showAtX()
it Worked. Thanks a lot for this library.
its something like this:
JS Fiddle
Check this example. in this example its showing 97% at most. but in my Actual example its showing 89% at most.
Got the solution with some changes in for Loop.
let a = []; chart.options.data.forEach((val, i)=>{ //alert(JSON.stringify(val), i); val.dataPoints.forEach((val2)=>{ a.push(val2.y) }) }) maxY = Math.max(...a); console.log(maxY, a)
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
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 } ] } ]
Thanks. It Worked.
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. },`
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.