2

I am trying to make a simple drill down that breaks down months into weeks, and am just trying to get the first column to work. I get the chart to render, but when I click on January it doesn't go to the linked chart. The external links on february and march work so I'm guessing it is a problem with the JSON data.

define(['app'], function (app) {
app.register.controller('MilesovertimeController', [function () {
    var vm = this;

    vm.myDataSource ={
        "chart": {
            "caption": "Miles Over Time",
            "subCaption": "Track the miles you have run over your entire running career!",
            "xAxisName": "Time (Month)",
            "yAxisName": "Miles",
            "theme": "fint"
        },
        "data": [
            {
                "label": "January",
                "value": "10",
                "link": "newchart-json-Jan"
            },
            {
                "label": "February",
                "value": "20",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "March",
                "value": "5",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "April",
                "value": "55",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "May",
                "value": "40",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "June",
                "value": "110",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "July",
                "value": "75",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "August",
                "value": "90",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "September",
                "value": "10",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "October",
                "value": "45",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "November",
                "value": "30",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "December",
                "value": "100",
                "link": "n-http://fusioncharts.com"
            }
        ],
        "linkeddata": [
            {
                "id": "Jan",
                "linkedchart": {
                    "chart": {
                        "caption": "Miles In January",
                        "subcaption": "This is what you did in January",
                        "xAxisName": "Weeks",
                        "yAxisName": "Miles"
                    },
                    "data": [
                        {
                            "label": "Week 1",
                            "value": "50"
                        },
                        {
                            "label": "Week 2",
                            "value": "25"
                        },
                        {
                            "label": "Week 3",
                            "value": "40"
                        },
                        {
                            "label": "Week 4",
                            "value": "10"
                        }
                    ]
                }
            }
        ]
    }

}]);
);

edit: This is what I'm trying to emulate http://www.fusioncharts.com/features/linkedcharts-for-drill-down/

IMPORTANT EDIT: When I click the january bar I get this error:

Uncaught RuntimeException: #03091456 chartobject-2.render() Error >> Unable to find the container DOM element.

<div class="container" ng-controller="MilesovertimeController as vm">
<div fusionCharts
     width="1000"
     height="550"
     type="column2d"
     datasource="{{vm.myDataSource}}">
</div>
</div>
Xerunix
  • 431
  • 1
  • 6
  • 21

1 Answers1

6

In order to get drill-down work make sure the directive has id

var app = angular.module('myApp', ["ng-fusioncharts"]);
app.controller('MilesovertimeController', [function () {
    var vm = this;

    vm.myDataSource ={
        "chart": {
            "caption": "Miles Over Time",
            "subCaption": "Track the miles you have run over your entire running career!",
            "xAxisName": "Time (Month)",
            "yAxisName": "Miles",
            "theme": "fint"
        },
        "data": [
            {
                "label": "January",
                "value": "10",
                "link": "newchart-json-Jan"
            },
            {
                "label": "February",
                "value": "20",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "March",
                "value": "5",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "April",
                "value": "55",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "May",
                "value": "40",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "June",
                "value": "110",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "July",
                "value": "75",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "August",
                "value": "90",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "September",
                "value": "10",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "October",
                "value": "45",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "November",
                "value": "30",
                "link": "n-http://fusioncharts.com"
            },
            {
                "label": "December",
                "value": "100",
                "link": "n-http://fusioncharts.com"
            }
        ],
        "linkeddata": [
            {
                "id": "Jan",
                "linkedchart": {
                    "chart": {
                        "caption": "Miles In January",
                        "subcaption": "This is what you did in January",
                        "xAxisName": "Weeks",
                        "yAxisName": "Miles"
                    },
                    "data": [
                        {
                            "label": "Week 1",
                            "value": "50"
                        },
                        {
                            "label": "Week 2",
                            "value": "25"
                        },
                        {
                            "label": "Week 3",
                            "value": "40"
                        },
                        {
                            "label": "Week 4",
                            "value": "10"
                        }
                    ]
                }
            }
        ]
    }

}]);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<script src="http://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script src="http://fusioncharts.github.io/angular-fusioncharts/demos/js/angular-fusioncharts.min.js"></script>



<div ng-app="myApp">
  <div class="container" ng-controller="MilesovertimeController as vm">
    <div fusionCharts
         width="1000"
         height="550"
         id="test"
         type="column2d"
         datasource="{{vm.myDataSource}}">
    </div>
  </div>
</div>
years_of_no_light
  • 938
  • 1
  • 10
  • 24