GithubHelp home page GithubHelp logo

Charts Not rendering about laravel-chartjs HOT 11 OPEN

fxcosta avatar fxcosta commented on May 21, 2024
Charts Not rendering

from laravel-chartjs.

Comments (11)

TesteHD avatar TesteHD commented on May 21, 2024 4

I had the same problem and after a long time I discovered the cause. I was declaring the library like this:

<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script>

It was me taking out the "min" and it worked. It was like this.

<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.js"></script>

from laravel-chartjs.

ibrunotome avatar ibrunotome commented on May 21, 2024 1

Hi, same problem here. The point is: the error start from nothing, last week works good, today the chart doesn't render, without put the fingers on the code between this weeks. Attached one pic of my console on safari, without errors.

Detail: The charts works well when page doesn't call the chart via ajax, but when calls, i got no render.

Again: works well two weeks ago and stoped from nothing.

I'lll appreciate some help. My config: php7.1 and Laravel 5.4.30.

screenshot 2017-07-30 14 20 21

from laravel-chartjs.

rahmatkurnia avatar rahmatkurnia commented on May 21, 2024

same problem

from laravel-chartjs.

fxcosta avatar fxcosta commented on May 21, 2024

Can you show a snippet of your code or reproduce or show the error? Check also in the console of your browser if there is any javascript error.

from laravel-chartjs.

fxcosta avatar fxcosta commented on May 21, 2024

@ibrunotome, this is a strange problem and I could not simulate it in my environment. Are there any warnings or errors displayed on the browser console? Can you post to me?

from laravel-chartjs.

ibrunotome avatar ibrunotome commented on May 21, 2024

Hi @fxcosta, no warnings and errors :(

from laravel-chartjs.

jokaorgua avatar jokaorgua commented on May 21, 2024

Had the same issue. The problem is in addEventListener('DOMContentLoaded'). For different reasons this event is not fired sometimes(in my case it was ajax request for the chart).

@fxcosta Please think about removing generating chart on DOMContentLoaded

P.S. I see that this event was added as a result of the #39 issue.

from laravel-chartjs.

jokaorgua avatar jokaorgua commented on May 21, 2024

As a workaround you can add something like

var DOMContentLoaded_event = document.createEvent("Event"); DOMContentLoaded_event.initEvent("DOMContentLoaded", true, true); window.document.dispatchEvent(DOMContentLoaded_event);

to ajax call AFTER setting html to your divs with chart (works in Chrome at least.)

from laravel-chartjs.

ibrunotome avatar ibrunotome commented on May 21, 2024

@fxcosta Do you have time to fix that with the solution above?

from laravel-chartjs.

fxcosta avatar fxcosta commented on May 21, 2024

Has anyone else been successful with this solution? Could you send me a pull request ?? I would be very grateful. I do not have much time lately to study what's going on with this previous event ... I'm sorry!

from laravel-chartjs.

cainytheslave avatar cainytheslave commented on May 21, 2024

Have the same problem, using Laravel Orchid as admin panel and everthing is lazy loaded with JS so no DOMContentLoaded ever. Would be great to have the option to completely remove this event listener.

from laravel-chartjs.

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.