Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to add customer JS code to customize the chart #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rastikw
Copy link

@rastikw rastikw commented Dec 23, 2020

I'd like to customize the chart immediately after its creation. This code could you specified during widget creation in a form of JsExpression.

@onmotion
Copy link
Owner

Hi!

I think it's not the widget responsibility to make a side js code insertion. Why don't you register $this->registerJs('') right after the widget?
Also the widget events can be useful https://www.yiiframework.com/doc/api/2.0/yii-base-widget#events

@rastikw
Copy link
Author

rastikw commented Dec 25, 2020

Hi, registering JS code right after the widget was the first idea. But you use setTimeout to create the chart, so it is not created by the time code is executed. And I don't think it is a good idea to add my code using setTimeout as well and hoping the browser will keep the proper order (which it may not in some circumstances).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants