Closed psarin closed 4 years ago
Not sure how. The developer who built this left the company. I'd suggest you look at the codebase.
Sorry I cannot be of more help.
Hi @psarin,
This has not been tested but I believe it should work. I suggest giving it a try.
The options
object supplied to the generate
function is passed through to the appropriate Chartist rendering function. Thus, including the plugins
key in that object should work the same as if it was included in the Chartist options
object.
I hope that helps.
The API says to pass in the plugin’s function as part of the options.plugins object. Unfortunately, the plugin needs access to the Chartist instance but this isn’t accessible (or even created) at the level of the calling function. Importing the plugin also requires access to window object, which is also not available to the calling function.
Cage
On Jan 6, 2020, at 2:34 PM, Alexandre Gigliotti notifications@github.com wrote:
Hi @psarin https://github.com/psarin,
This has not been tested but I believe it should work. I suggest giving it a try.
The options object supplied to the generate function is passed through to the appropriate Chartist rendering function. Thus, including the plugins key in that object should work the same as if it was included in the Chartist options object.
I hope that helps.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/panosoft/node-chartist/issues/23?email_source=notifications&email_token=AADWX7RHPGM364ZZIA75Q5DQ4OBVTA5CNFSM4KC6N6M2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIGQYGQ#issuecomment-571280410, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADWX7TVE3I526TB5XBGCKLQ4OBVTANCNFSM4KC6N6MQ.
Hi @psarin
From the generate documentation:
options - An object or a function that returns an object of chart options. If a function is used, it will be called with the Chartist object.
Using a function here should give you access to what you need.
Thanks, that helps but unfortunately, I’m not clear how or where to import the plugin. If I use require to pull it in, it complains that “window” is not defined.
I could modify the source files to perform the import after window is defined but that seems as if it would break encapsulation of the project.
On Jan 8, 2020, at 10:42 AM, Alexandre Gigliotti notifications@github.com wrote:
Hi @psarin https://github.com/psarin From the generate documentation:
options - An object or a function that returns an object of chart options. If a function is used, it will be called with the Chartist object. Using a function here should give you access to what you need.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/panosoft/node-chartist/issues/23?email_source=notifications&email_token=AADWX7VPSTEKPFAHGICUQITQ4XX4XA5CNFSM4KC6N6M2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIM7OHI#issuecomment-572127005, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADWX7TCLVHBOGXLTB7B5KTQ4XX4XANCNFSM4KC6N6MQ.
Is it possible to use plugins? If so, how could I do this. For example, I'd like to use the chartist ctPointLabels plugin (https://gionkunz.github.io/chartist-js/plugins.html). Thanks! Great library, btw!