-
Notifications
You must be signed in to change notification settings - Fork 327
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
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
@@ -3,7 +3,8 @@ | |||
|
|||
<head> | |||
<title>Bar Chart Pan</title> | |||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | |||
<!--script src="https://cdn.jsdelivr.net/npm/[email protected]"></script--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.ticks.min = rangeMinLimiter(zoomOptions, scale.min + minDelta); | ||
scale.options.ticks.max = rangeMaxLimiter(zoomOptions, scale.max - maxDelta); | ||
scale.options.min = rangeMinLimiter(zoomOptions, scale.min + minDelta); | ||
scale.options.max = rangeMaxLimiter(zoomOptions, scale.max - maxDelta); | ||
} | ||
|
||
function zoomTimeScale(scale, zoom, center, zoomOptions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with panTimeScale
below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could remove this function now and call
zoomNumericalScale
where 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with
panTimeScale
below
I think you wanted to write panCategoryScale
, doesn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -4,9 +4,10 @@ | |||
<head> | |||
<title>Line Chart</title> | |||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script> | |||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | |||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | |||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chartjs-adapter-moment.min.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this just https://cdn.jsdelivr.net/npm/[email protected]
instead of https://cdn.jsdelivr.net/npm/[email protected]/dist/chartjs-adapter-moment.min.js
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/plugin.js
Outdated
} | ||
} | ||
|
||
function panTimeScale(scale, delta, panOptions) { | ||
function panCategoryScale(scale, delta, panOptions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Let's not use panNumericScale
in panCategoryScale
to minimize the number of changes in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Let's not use
panNumericScale
inpanCategoryScale
to 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