Porting to CHART.JS 3 (using master)#390
Conversation
|
I submit this PR but I don't have enough experience about karma and testing part, therefore it should be review. |
|
@stockiNail it's possible that the tests are failing because you did not update the |
samples/pan-bar.html
Outdated
| <head> | ||
| <title>Bar Chart Pan</title> | ||
| <script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.1"></script> | ||
| <!--script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.1"></script--> |
There was a problem hiding this comment.
you could probably update this to 3.0.0-beta.6 now that it's out?
|
I changed only the code because I'm not familiar with javascript and its compiling tools and configuration. |
|
@benmccann I've started working on that |
FYI, only 1 test is failing now: |
src/plugin.js
Outdated
| scale.options.max = rangeMaxLimiter(zoomOptions, scale.max - maxDelta); | ||
| } | ||
|
|
||
| function zoomTimeScale(scale, zoom, center, zoomOptions) { |
There was a problem hiding this comment.
you could remove this function now and call zoomNumericalScale where it's called since that's all it does anyway
There was a problem hiding this comment.
Same with panTimeScale below
There was a problem hiding this comment.
you could remove this function now and call
zoomNumericalScalewhere it's called since that's all it does anyway
done. I'm still having a look but I decided to push anyway the current updates
There was a problem hiding this comment.
Same with
panTimeScalebelow
I think you wanted to write panCategoryScale, doesn't it?
There was a problem hiding this comment.
What I mean is panTimeScale just calls panNumericalScale directly. You could just delete panTimeScale and call panNumericalScale where panTimeScale is used to avoid the extra method that no longer is really necessary
There was a problem hiding this comment.
done, removed also zoomTimeScale
|
@benmccann fixed all test cases. |
|
@benmccann let me outline a couple of topics. Other plugins of |
|
Hmm. Seems I am prevented from merging this because Travis is down. I think I will need someone to disable Travis. Then we can turn on Github Actions (#402) |
I have tried some changes on Travis configuration but it does not work. It looks like you said. |
|
@stockiNail I switched the build to GitHub Actions on |
done! and sounds working |
It went wrong but I don't know why because the branch is currently rebased to the master and locally the tests are working. |
|
Maybe it's running a different sequence of commands. You can run |
The issue seems to be related to the path. I have changed but it's wrong to set '..'' because some warnings/issues are still there for this path and also locally it does not work with Therefore I revert the change, going to default |
|
You need to make the |
@kurkle as usual, ur awesome!! THANK YOU! I was getting crazy even because I don't know Karma and GHA.... |
Anyway something sounds strange, because setting |
I think it just did not find the tests anymore: |
|
You are right... :( |
samples/zoom-time.html
Outdated
| <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script> | ||
| <script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.1"></script> | ||
| <script src="https://cdn.jsdelivr.net/npm/chart.js@3.0.0-beta.6"></script> | ||
| <script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-moment@0.1.2/dist/chartjs-adapter-moment.min.js"></script> |
There was a problem hiding this comment.
Can we make this just https://cdn.jsdelivr.net/npm/chartjs-adapter-moment@0.1.2 instead of https://cdn.jsdelivr.net/npm/chartjs-adapter-moment@0.1.2/dist/chartjs-adapter-moment.min.js ?
src/plugin.js
Outdated
| } | ||
|
|
||
| function panTimeScale(scale, delta, panOptions) { | ||
| function panCategoryScale(scale, delta, panOptions) { |
There was a problem hiding this comment.
Can you move this back above panNumericalScale? It's difficult to tell what's change since its location in the file has changed
There was a problem hiding this comment.
Not possible, due to:
115:1 warning Function 'zoomCategoryScale' has a complexity of 15 complexity
240:2 error 'panNumericalScale' was used before it was defined no-use-before-define
243:1 warning Function 'panNumericalScale' has a complexity of 13 complexity
413:41 warning Function has a complexity of 11 complexity
There was a problem hiding this comment.
If you want to use the panNumericScale into panCategoryScale, we must define it before, otherwise we must remove the rule of no-use-before-define.
As you prefer.
There was a problem hiding this comment.
Ok. Let's not use panNumericScale in panCategoryScale to minimize the number of changes in this PR
There was a problem hiding this comment.
Ok. Let's not use
panNumericScaleinpanCategoryScaleto minimize the number of changes in this PR
Done!
|
thank you so much for all the work on this upgrade!! appreciate your patience working through the issues and comments |
|
@benmccann I have to thank you for your patience. |
|
Yes, the code for this plugin is a bit outdated and it would be nice to update it to more closely match the setup of the main library and the other plugins |
|
Great to see it supporting v3. How can I use this? (As it is not yet released as a version). Because when I put the plugin.js in my project and add it as a script tag I get the following error: And when I add I guess I need to add it all separately then. But having too low knowledge of Javascript module things :) |
Answered in #376 |
fixes #376