Git Product home page Git Product logo

Comments (10)

jonrh avatar jonrh commented on May 17, 2024 3

I had noticed this as well (in the code & delay) and am in favour of having the needed dependencies be baked into the eventual React Native bundle JS file (if possible), i.e. no extra network requests. It would also be of benefit for offline apps. I suspect this might come down to licences.

I've been playing a bit around with the code and I believe that jQuery is not needed. As far as I can tell the only thing jQuery is used for as of now is to register a document ready callback. As seen here:

$(function () {
    Highcharts.stockChart('container', highchartConfigObject);
});

Without being 100% I think this could be replaced as such and no longer needing the jQuery dependency:

document.addEventListener("DOMContentLoaded", function() {
    Highcharts.chart('container', highchartConfigObject);
});

from react-native-highcharts.

ShMcK avatar ShMcK commented on May 17, 2024 2

Have you considered wrapping Highcharts with react-highcharts?

from react-native-highcharts.

mmazzarolo avatar mmazzarolo commented on May 17, 2024

Hi everyone!
Does anyone have any hints on how to use offline bundles instead?

from react-native-highcharts.

jonrh avatar jonrh commented on May 17, 2024

Update: Please ignore, will probably not work. See reply below.

@mmazzarolo One dirty way would be to modify the file react-native-ChartView.js. There you could swap out line 38

<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>

with:

<script>put the contents of the https://code.jquery.com/jquery-2.1.4.min.js file here</script>

You would then do this for all the <script> tags that include remote JavaScript source files. This is one quick and dirty way to do it until this library would have native support for it. Hope it helps!

from react-native-highcharts.

mmazzarolo avatar mmazzarolo commented on May 17, 2024

Thanks, I thought there was some kind of native implementation for the RN webview but I guess that the easier solution is still the manual replacement :)

from react-native-highcharts.

minhquankq avatar minhquankq commented on May 17, 2024

@jonrh I have tried that way - Put the content of highcharts.js into script tag, remove script jquery by your suggestion. But the chart was not render. have you tried that way?

from react-native-highcharts.

jonrh avatar jonrh commented on May 17, 2024

@minhquankq I'm very sorry, you're right. After your reply I remembered I did once try it and it failed, confused it with something else. If I remember correctly there were a lot of characters that needed to be escaped for that to work (too much trouble IMO).

I think the long-term solution would be to use the highcharts package on npm. I haven't attempted it though.

from react-native-highcharts.

Infinity0106 avatar Infinity0106 commented on May 17, 2024

I tried to implement it with downloaded libraries, I tried with highcharts and highstock and I could run it but when I imported the text for jquery some weird error came up, so I leave it like that, but if you want i cant upload the version with static highcharts and static highstock

from react-native-highcharts.

jonrh avatar jonrh commented on May 17, 2024

@Infinity0106 Thanks for your update. In my attempts I was able to get rid of the jQuery dependency with the following code (see my reply above):

document.addEventListener("DOMContentLoaded", function() {
    Highcharts.chart('container', highchartConfigObject);
});

from react-native-highcharts.

PvanHengel avatar PvanHengel commented on May 17, 2024

Check out my comments on #54 I put some hits there on how we got it to work. @mmazzarolo

from react-native-highcharts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.