0

I am basically from 'c language' background, and having no sound idea about scripting.

what i wanted to achieve is this:

There is a bar graph which is presented in the SwapView. Now each time when the user visits this SwapView, i would like to reload the Bargrap with new set of datas. Assume that i have a data globally ie: window.myvalues. Which event i need to capture, and how to do that?

Kindly advice. Here is the sample which i have used from dojo site.

 <div id="barview" data-dojo-type="dojox.mobile.SwapView">



        <script>
            function mybarchartNode(){


                require([
                         // Require the basic chart class
                         "dojox/charting/Chart",

                         // Require the theme of our choosing
                         "dojox/charting/themes/MiamiNice",

                         //  We want to plot Columns
                         "dojox/charting/plot2d/Columns",

                         // Require the highlighter
                         "dojox/charting/action2d/Highlight",

                         //  We want to use Markers
                         "dojox/charting/plot2d/Markers",

                         //  We'll use default x/y axes
                         "dojox/charting/axis2d/Default",

                         // Wait until the DOM is ready
                         "dojo/domReady!"
                         ], function(Chart, theme, ColumnsPlot, Highlight) {


                        console.log ("Data set in the bar graph ");
                        console.log (window.myDatas);
                        // Define the data
                        var chartData = [10000,9200,11811,12000,7662,13887,14200,12222,12000,10009,11288,12099];

                        // Create the chart within it's "holding" node
                        var chart = new Chart("barchartNode");

                        // Set the theme
                        chart.setTheme(theme);

                        // Add the only/default plot
                        chart.addPlot("default", {
                                      type: ColumnsPlot,
                                      markers: true,
                                      gap: 5
                                      });

                        // Add axes
                        chart.addAxis("x");
                        chart.addAxis("y", { vertical: true, fixLower: "major", fixUpper: "major" });

                        // Add the series of data
                        chart.addSeries("Monthly Sales",chartData);

                        // Highlight!
                        new Highlight(chart,"default");

                        // Render the chart!
                        chart.render();
                        });




            }  /* Function End */

            </script>





        <div id="barchartNode" style="width: 250px; height: 150px;"></div>

        </div> <!- swap space end -->




<!-- configure and load dojo -->
    <script src="dojo/dojo.js" data-dojo-config="isDebug:1, async:1"></script>
    <script>

        require(["dojox/mobile/parser", "dijit/registry", "dojox/mobile",  "dojox/mobile/SwapView", "dojox/mobile/TabBar", "dojox/mobile/TreeView", "dijit/tree/TreeStoreModel","dojox/mobile/Button", "dojox/mobile/deviceTheme", "dojox/mobile/compat", "dojo/domReady!"],
                function(parser) {
                parser.parse();
                });

        mybarchartNode();
        </script>     
Whoami
  • 13,930
  • 19
  • 84
  • 140
  • The [dojo API](http://dojotoolkit.org/api/) doesn't have any info on the mobile libraries :(. Maybe You should download the dojo source code and search for the events defined for the `SwapView`. – undefined Oct 26 '12 at 06:29

1 Answers1

0

You may hook up onAfterTransitionIn or onBeforeTransitionIn of dojox/mobile/SwapView

Quote from Dojo Reference

Stub function to connect to from your application. Called before/after the arriving transition occurs.

didxga
  • 5,935
  • 4
  • 43
  • 58