AnsweredAssumed Answered

Tabs in Popup Window

Question asked by sarojthapa60 on Nov 21, 2016
Latest reply on May 31, 2017 by sarojthapa60

I am trying to create two tabs in Info Window and display pie charts. The second tab displays the pie chart, but I could not create and load a pie chart in the first tab. 



<!DOCTYPE html>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
    <title>Pie Chart</title>
    <link rel="stylesheet" href="">
    <link rel="stylesheet" href="">
        html, body, #map {
            height: 100%;
            width: 100%;
            margin: 0;
            padding: 0;
        .chart {
            padding:0 !important;
    <script src=""></script>
        var map;
        // Try other themes: Julie, CubanShirts, PrimaryColors, Charged, BlueDusk, Bahamation, Harmony, Shrooms, Minty, Tom
        var theme = "PrimaryColors";
            "esri/map", "esri/layers/FeatureLayer",
            "esri/dijit/InfoWindow", "esri/InfoTemplate",
            "esri/symbols/SimpleFillSymbol", "esri/renderers/SimpleRenderer",
            "dijit/layout/ContentPane", "dijit/layout/TabContainer",
            "dojox/charting/Chart2D", "dojox/charting/plot2d/Pie",
            "dojox/charting/action2d/Highlight", "dojox/charting/action2d/MoveSlice", "dojox/charting/action2d/Tooltip",
            "dojox/charting/themes/" + theme,
            "dojo/dom-construct", "dojo/dom-class",
            "dojo/number", "dojo/domReady!"
        ], function(
                Map, FeatureLayer,
                InfoWindow, InfoTemplate,
                SimpleFillSymbol, SimpleRenderer,
                ContentPane, TabContainer,
                Chart2D, Pie,
                Highlight, MoveSlice, Tooltip,
                domConstruct, domClass,
                number, parser
        ) {
            // Use the info window instead of the popup.
            var infoWindow = new InfoWindow(null, domConstruct.create("div"));

            map = new Map("map", {
                basemap: "topo",
                center: [-113.405, 43.521],
                infoWindow: infoWindow,
                zoom: 5
            map.infoWindow.resize(275, 275);

            var template = new esri.InfoTemplate();
            template.setTitle("<b> ${Instl_Name}</b>");

            var layer = new FeatureLayer("RESTUrl/FeatureServer/0", {
                mode: FeatureLayer.MODE_ONDEMAND,
                infoTemplate: template,
                outFields: ["*"]


            function getWindowContent(graphic) {
                // Make a tab container.
                var tc = new TabContainer({
                    style: "width:100%;height:100%;"
                }, domConstruct.create("div"));

                // Display attribute information.
                var cp1 = new ContentPane({
                    title: "Collection"

                //Codes to create a tab for the first pie chart

                // Display a dojo pie chart for the complete/incomplete percentage.
                var cp2 = new ContentPane({
                    title: "Processing"


                // Create the chart that will display in the second tab.
                var c = domConstruct.create("div", {
                    id: "demoChart"
                }, domConstruct.create("div"));
                var chart = new Chart2D(c);
                domClass.add(chart, "chart");

                // Apply a color theme to the chart.
                chart.addPlot("default", {
                    type: "Pie",
                    radius: 70,
                    htmlLabels: true
      "selectedChildWidget", function(name, oldVal, newVal){
                    if ( newVal.title === "Processing" ) {

                // Calculate percent complete/ incomplete.
                var total = 100;
                var complete_processing = number.round(graphic.attributes.Data_Development);
                var incomplete = total - complete_processing;
                chart.addSeries("% Complete", [{
                    y: incomplete,
                    tooltip: incomplete,
                    text: "% Incomplete",
                    color: "red"
                }, {

                    y: complete_processing,
                    tooltip: complete_processing,
                    text: "% Complete",
                    color: "green"
                //highlight the chart and display tooltips when you mouse over a slice.
                new Highlight(chart, "default");
                new Tooltip(chart, "default");
                new MoveSlice(chart, "default");

                cp2.set("content", chart.node);
                return tc.domNode;

<body class="claro">
<div id="map"></div>