peity
peity copied to clipboard
Remove jQuery Dependency
Is this in the roadmap at all?
Huge fan of Peity but I'm wanting to drop jQuery. Would love to see it ported over to vanilla JS. I can give it a go if you have no plans for it?
Definitely, I'd like to remove the dependency on jQuery - though probably continue to build a jQuery plugin version.
Is there any update on this or has this idea been canned?
There's no update but here's some more of my thinking:
I had intended to create a jQuery-free version of Peity that would be used by the jQuery version and could also then be used by React (#75) or Angular - I also wondered whether it could be abstract enough to build an IE-compatible version that outputted VML which is no longer an issue.
Anyway, a core concern of this library is to have a small filesize and all that abstraction stuff is slightly at odds with that intention. Also, part of being able to keep Peity's filesize small is because jQuery gives so much - including utility functions like extend()
.
I still like the idea of making a new version of Peity that expects a modern JS environment - instead of avoiding ES5 additions even. I'll keep this issue updated with any progress or thoughts.
Thanks for prodding me about this it's actually been quite motivational :)
https://github.com/railsjazz/peity_vanilla
Vanilla JS version of this plugin. We plan to extend this further and add more chart types in the future.
the railsjazz team did a nice job removing jquery and refactoring the code, but in my view it should have been done in the context of this project, even if MIT licence is very permissive. Can you comment on this @benpickles ?
I am bringing up this here, becuase I implementing a maplibre application in angular which shows a pie-chart for the clustered markers, similar to this example:
https://github.com/maplibre/ngx-maplibre-gl/blob/main/projects/showcase/src/app/demo/examples/cluster-html.component.ts
I could use the vanilla version, but is it not very good becuase angular discourage direct manipulation of DOM. Basically what I would need from peity is the calculation of the segments only, which can be used in an Angular template.
the angular template example can be found at this line: https://github.com/maplibre/ngx-maplibre-gl/blob/main/projects/showcase/src/app/demo/examples/cluster-html.component.ts#L130
I'm looking at this, current status: 28 failed, 25 passed, 53 total
The plan is to switch from a jQuery plugin to web components - <peity-bar data="1,2,3,5,8"></peity-bar>
etc - and also expose the individual chart functions so they can be used by others.
The jQuery plugin can remain, maybe it uses the chart functions directly or maybe it wraps the web components. I'm tempted to create a React version that's a wrapper for the web components, but I'm not particularly keen on making/maintaining one for each framework.