4

I use zingchart with angular, It works perfect when I display a chart in a single page, but when I try to include the template with zingchart in a tab, It doesn't show and I don't have any error in a browser's console,

HTML :

<div zingchart id="chart-1" zc-json="myJson"></div>

CONTROLLER of zingchart's view:

$scope.myJson = {
type: "line",
series : [
                    {
                        values : data1,
                        text : "A",
                        lineColor : "#00ACF2",
                        marker : {
                            borderColor : "#00ACF2"
                        }
                    },
                    {
                        values : data2,
                        text : "B",
                        lineColor : "#86CA00",
                        marker : {
                            borderColor: "#86CA00"
                        }
                    }
                ]
};

CONTROLLER that I use to include my view with zingchart :

$templateRequest(template).then(function (html) { 
var template = angular.element(html); 
contenu = $compile(template)($scope); 
$timeout(function () { $('#onglet').append(contenu); }, 100); 
});

Thank you

Cœur
  • 37,241
  • 25
  • 195
  • 267
S.Nobla
  • 51
  • 4
  • I use angular zingchart directive https://github.com/zingchart/ZingChart-AngularJS and the code I use for include : $templateRequest(template).then(function (html) { var template = angular.element(html); contenu = $compile(template)($scope); $timeout(function () { $('#onglet').append(contenu); }, 100); }); – S.Nobla Jul 25 '16 at 10:41
  • It would be very helpful if you could update the original question with all the code you are running with your directive. – nardecky Jul 25 '16 at 17:38
  • I added the code, thank you – S.Nobla Jul 26 '16 at 11:28
  • Check out our new Angular directive [update](https://blog.zingchart.com/2016/08/12/angularjs-directive-v1-1-0/). It takes care of chart cleanup in memory so this may alleviate your issue. – nardecky Aug 15 '16 at 19:49
  • It was because of "id" zingchart element, the new angular directive resolved my issue, thank you – S.Nobla Aug 16 '16 at 09:07

0 Answers0