peity icon indicating copy to clipboard operation
peity copied to clipboard

Remove jQuery Dependency

Open ghost opened this issue 9 years ago • 6 comments

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?

ghost avatar Jun 13 '15 05:06 ghost

Definitely, I'd like to remove the dependency on jQuery - though probably continue to build a jQuery plugin version.

benpickles avatar Jun 16 '15 08:06 benpickles

Is there any update on this or has this idea been canned?

jamestowers avatar Apr 13 '17 10:04 jamestowers

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 :)

benpickles avatar Apr 24 '17 14:04 benpickles

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.

igorkasyanchuk avatar Apr 29 '22 14:04 igorkasyanchuk

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

kovax avatar Sep 28 '23 13:09 kovax

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.

benpickles avatar Mar 01 '24 18:03 benpickles