Skip to content

Get getMinMax from a scale #11250

Answered by stockiNail
ronildo asked this question in Q&A
Apr 24, 2023 · 2 comments · 7 replies
Discussion options

You must be logged in to vote

@ronildo as far as I understood, you are trying to access to the controller to get min and max. Let me assume you are using the line controller (but it could be the same for bar or others).

To be compliant with Chart.js code and visibility of the methods, you could extend the existing line controller adding a public method which is invoking the getMinMax one.

Here I'm creating my LINE controller (vanillaJS but it's the same with other framework but you need to import the controller and remove Chart namespace).

// Controller
class MyLineController extends Chart.LineController {
  
  getMaxMin(scale, canStack) {
    return super.getMinMax(scale, canStack);
  }
  
};
MyLineController.id = 'm…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
2 replies
@stockiNail
Comment options

@ronildo
Comment options

Comment options

You must be logged in to vote
5 replies
@kurkle
Comment options

@stockiNail
Comment options

@kurkle
Comment options

@stockiNail
Comment options

@ronildo
Comment options

Answer selected by ronildo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants