frappe / charts

Simple, responsive, modern SVG Charts with zero dependencies
https://frappe.io/charts
MIT License
14.94k stars 718 forks source link

Support IE 11 #13

Closed chintan9 closed 6 years ago

chintan9 commented 6 years ago

It simply does not work IE 11. How can I support this library with IE11(polyfills or anything else)

sakopov commented 6 years ago

IE 11 doesn't support ES6. I don't think there is much you could do here.

chintan9 commented 6 years ago

@sakopov It can work. you may test now http://jsbin.com/guvuvav/1/edit?html,js,output

capturfiles

you need this file https://raw.githubusercontent.com/chintan9/charts/master/dist/frappe-charts.ie11.min.js

pratu16x7 commented 6 years ago

@chintan9 Could you elaborate on your changes? It's tough to make out from the build file.

chintan9 commented 6 years ago

@pratu16x7 Simply I decompile you code to es6 (es2015) level and add polyfills for ie11.

I think we can do it for rollup also. you have to preset es2015 than ask user to add polyfill to support IE11.

achillesrasquinha commented 6 years ago

How about adding the polyfill into our src/scripts to make this simpler? Closing this for now. Please feel free to reopen.

pratu16x7 commented 6 years ago

Will have to agree with @sakopov. About polyfills, from https://babeljs.io/docs/usage/polyfill: This will emulate a full ES2015+ environment and is intended to be used in an application rather than a library/tool.

We don't intend to go that way; that'd defeat the zero-dep purpose. We'd be happy if there is a more elegant way to achieve this. Closing for now.

chintan9 commented 6 years ago

@pratu16x7 Transpile whole lib to es5 would be solution. Meanwhile We put in docs support IE11 via environment add only this line in head tag

<script type="text/javascript">
    if(/MSIE \d|Trident.*rv:/.test(navigator.userAgent))
        document.write('<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.5.1/shim.min.js"></script');
</script>

https://jsbin.com/biqoyuxomu/1/edit?html,js,output

It does not require any js changes on charts lib.