Jibeee
Jibeee

Reputation: 852

What is self.scale.endPoint chartJs v2.0?

I'm trying hard to add functionalities to my charts by re-writing draw chart functions of chartJS v1.x to v2.0. A lot of features inside the chart draw functions use "self.scale.endPoint"in v1.x but it looks like there are lots of changes in the v2.0 structure and I'm unable to find it. Like here :

// the min is required so animation does not start from below the axes
bar.y = Math.min(bar.y + radius, self.scale.endPoint - 1);

How can I use this value ?

JSFiddle can be seen here.

Upvotes: 1

Views: 541

Answers (1)

David
David

Reputation: 773

In chartJS v2.x you must specify what axis you want to access (as they now support multiple). For your issue, you want to use the default y axis, which should be accessible in such a manner

this.chart.scales["y-axis-0"]

Although I haven't tested it myself, I think endPoint is now called bottom, and therefore you can get the same value like this:

this.chart.scales["y-axis-0"].bottom

Upvotes: 2

Related Questions