Software Archive
Read-only legacy content
17061 Discussions

Chart.js

Braglin__Fabio
Beginner
585 Views

I'm triyng to add a chart to my Android app using Chart.js

At Intel-XDK emulator and in Debug Mode (DebugTab) this works perfectly, but if I try run it using App Preview or if I build the apk I can't see the chart.

<code>
function Skills(){
        document.getElementById("MinhasHabilidades").style.display = 'block';
        document.getElementById("inicio").style.display = 'none';

        var ChartData = {
            labels: ["Ler", "Ouvir", "Escrever", "Falar"],
            datasets: [{
                fillColor: "rgba(0,128,255,0.5)",
                strokeColor: "rgba(220,220,220,0.8)",
                highlightFill: "rgba(220,220,220,0.75)",
                highlightStroke: "rgba(220,220,220,1)",
                data: [9, 13, 4, 12]
            }]
        };

        var ctx = document.getElementById("myChart").getContext("2d");
        window.myBar = new Chart(ctx).Radar(ChartData, {responsive: true});
    }
</code>

When I call the "new Chart(ctx)..." the function stop.

0 Kudos
1 Solution
Wesley_S_1
New Contributor I
585 Views

Change <script src="js/chart.js"></script> TO <script src="js/Chart.js"></script< and its works in the example project.

Case-sensitive.

View solution in original post

0 Kudos
7 Replies
Amrita_C_Intel
Employee
585 Views

Are you using any plugins? If yes then which kind? Featured, third party or core. Emulator does not provide you the true behavior. so try installing that app on your device.

0 Kudos
Amrita_C_Intel
Employee
585 Views

I would recommend try building for Crosswalk.

0 Kudos
Braglin__Fabio
Beginner
585 Views

Dear Amrita,

As I said, I already create the apk and have installed in 3 different mobiles (Galaxy Gran Prime, Moto G, Galaxy Gran Duos), same problem happen. Please, refer to the Build Log below:

Build Log:
  • Building a Cordova 4.1.2 application.
  • The application name is "1000in100"
  • The package name is "onethinonehdr.bragot.ad"
  • Plugin "org.apache.cordova.device" (0.2.13) installed.
  • Plugin "org.apache.cordova.splashscreen" (0.3.5) installed.
  • Plugin "com.google.playservices" (19.0.0) installed.
  • Plugin "com.google.admobsdk" (6.12.2) installed.
  • Plugin "com.rjfun.cordova.plugin.admob" (2.1.7) installed.
  • Plugin "com.wordsbaking.cordova.tts" (0.2.1) installed.
  • Plugin "org.apache.cordova.inappbrowser" (0.5.4) installed.
  • Plugin "com.phonegap.plugins.speech" (1.0.0) installed.
  • Plugin "de.appplant.cordova.plugin.local-notification" (0.8.1) installed.
  • App name updated to [1000in100]
  • Updated "minSdkVersion" with "10"
  • Updated "targetSdkVersion" with "19"
  • Updated "installLocation" to "auto"
  • Added "screenOrientation" to "portrait"
  • Updated "versionCode" to "1"
  • Updated "versionName" to "0.0.1"
  • Added "debuggable" to "false"

About the crosswalk, the apk is too big! But I will try and tell you the result.... App Preview is based on crosswalk webview, no?????

 

Edited...

I have tried the Crosswalk... can't display the chart too...

Also I have created a new project only with Chart.js... only works in emulator... could you create an example????

 

Regards

0 Kudos
Amrita_C_Intel
Employee
585 Views

Can you send me .zip file of your project through PM? So that I can have more details and provide you better solution.

0 Kudos
Braglin__Fabio
Beginner
585 Views

This is an example app!! The issue is the same!

0 Kudos
Wesley_S_1
New Contributor I
586 Views

Change <script src="js/chart.js"></script> TO <script src="js/Chart.js"></script< and its works in the example project.

Case-sensitive.

0 Kudos
Braglin__Fabio
Beginner
585 Views

Thank you Wesley, it works, I didn't think about it before.

0 Kudos
Reply