1

In wavemaker a got an app that display charts with dojo charting, some charts have a lot data so the chart is compressed so i look around and found that we could add zooming and panning, found an example on the web link:http://informatik.fh-brandenburg.de/~porebskk/dojo.html

i look at the source code and it looks like i only had to add this to my code

dojo.require("dojox.charting.action2d.MouseZoomAndPan");

and then call it before rendering the chart

new dojox.charting.action2d.MouseZoomAndPan(chart, "default");

My problem is when i had this to my source code dojo.require("dojox.charting.action2d.MouseZoomAndPan");

and run the app i get "page Main as error" and my application does not work anymore

if i do this then my application comesback to life //dojo.require("dojox.charting.action2d.MouseZoomAndPan");

i create a new application and i only had this on top of the main page and get the error again dojo.require("dojox.charting.action2d.MouseZoomAndPan");

in the wavemaker debugger i get "error parsing pages/Main/Main.js"

4

1 回答 1

0

我使用的是 AMD 风格,但这可能会对您有所帮助。我能够通过您的链接找到丢失的部分。

Dojo 工具包在这里有一些稍微不正确的代码(MouseZoomAndPan 部分),但它会给你我下面的代码,这就是为什么我在 MouseZoomAndPan(...); 之后注释掉代码的原因。

define(["dojox/charting/themes/Claro", "dojox/charting/Chart", "dojox/charting/axis2d/Default"
    , "dojox/charting/plot2d/Lines", "dojox/charting/action2d/MouseZoomAndPan"],
function (claro, Chart, Default, Lines, MouseZoomAndPan) {
    return {
        createZoomableChart: function () {
            "use strict";
            var chart = new Chart("mouseZoom");
            chart.addAxis("x", { type: Default, enableCache: true })
                .addAxis("y", { vertical: true })
                .addPlot("default", { type: Lines, enableCache: true })
                .addSeries("Series A", [1, 2, 2, 3, 4, 8, 6, 7, 5]);
            var mzap = new MouseZoomAndPan(chart, "default");//, { axis: "x", "none" });
            chart.render();
        },
        init: function() {
            this.createZoomableChart();
        }
    };
});
于 2014-02-20T00:22:07.973 回答