Dojocharts没有出现在Mozilla和IE中

时间:2014-07-09 05:33:41

标签: javascript dojo dojox.charting

我使用dojocharts生成了大量图表。其中一个是dojo中的主要问题,即浏览器兼容性问题。但是没有出现在Mozilla和IE浏览器中的图表只显示在chrome.Some道功能也不起作用。在我的图表中我添加了dojo指标。如果我添加指标然后图表不显示,如果我删除指标然后图表显示。但是我想图表会显示两个指标和X,Y轴。我正在搜索Google,SO以及dojo论坛,但找不到合适的解决方案来解决我的问题。所以建议我如何解决我的浏览器兼容性问题。

这是我的代码

  <script type="text/javascript">

 dojo.require("dojox.charting.Chart");
 dojo.require("dojox.charting.axis2d.Default");
  dojo.require("dojox.charting.plot2d.Default");
  dojo.require("dojox.charting.plot2d.ClusteredColumns");
 dojo.require("dojox.charting.widget.SelectableLegend");
 dojo.require("dojox.charting.plot2d.Markers");
 dojo.require("dojox.charting.plot2d.Grid");
 dojo.require("dojox.charting.plot2d.Indicator");
 dojo.require("dojox.charting.action2d.Highlight");
 dojo.require("dojox.charting.action2d.Magnify");
 dojo.require("dojox.charting.action2d.MoveSlice");
 dojo.require("dojox.charting.action2d.Shake");
 dojo.require("dojox.charting.action2d.Tooltip");
 dojo.require("dojox.charting.plot2d.Indicator");
 dojo.require("dojox.charting.widget.Legend");

 dojo.require("dojo.colors");
 dojo.require("dojo.fx.easing");
 dojo.require("dojox.charting.themes.Mytheme");
 dojo.require("dojox.dtl");
 dojo.require("dojox.dtl.Context");

    var dc = dojox.charting;

    var dur = 450;

    makeObjects = function(){
  var chart6 = new dc.Chart("chart1");
  var myLabelFunc = function(text, value, precision){
  return text;

  };
  chart6.setTheme(dc.themes.Mytheme);
   chart6.addAxis("x" ,{
                    title:"Project",
                      titleGap:40, 
                      titleFont: "normal normal bold 14px Tahoma",
                      titleFontColor: "black",
                      titleOrientation: "away",
                      stroke:"#A2ADBC", 
                      //labelSizeChange: true,
                      natural: true,
                    //  rotation:-20,
                      majorTick: {color: "#A2ADBC", length: 10},
                      majorTicks:true,
                      majorTickStep:1,
                      dropLabels:false,
                      minorTicks:false,
                    fixLower : "minor",
                    fixUpper : "minor",
                //  dropLabels : true,
                    //min : 10,
                    //max : 20,
                    //from: 0,
                    to:   10.9,
                    labels: <?php echo  json_encode($this->masterChart,JSON_NUMERIC_CHECK); ?>,
                     font: "normal normal bold 11px Constantia",      
                      fontColor: "black"                             
                    // labelFunc: myLabelFunc
                }
    );
chart6.addAxis("y", {
                    title: "Area in SqFt",
                    titleFont: "normal normal bold 14px Tahoma",
                    titleGap: 20, 
                    titleFontColor: "black",
                    stroke:"#A2ADBC",
              font: "normal normal bold 9px Tahoma",
              fontColor: "black",
                    vertical : true,
                    fixLower : "minor",
                    fixUpper : "minor",

                //htmlLabels : true,
                    majorTick: {color: "#A2ADBC", length: 10},
         minorTicks:true,
          majorTicks:true,
         majorTickStep:44,
         minorTickstep:11,

       // minorTickstep:5,

                    min : <?php echo $this->masterChart_base_line_bed[0] ['area']; ?>,
                    //max : 20,
                    from:30,
                    //to:   250
         labelFunc: myLabelFunc
                }

      );
     chart6.addPlot("default", {type: "ClusteredColumns", gap: 8,
                    labels: true,
                //  minBarSize:5,
                    labelStyle:"outside",
                    fontColor:"black",
                     precision: 1,
                    animate : {
                        duration : 1000
                    }

         });
        chart6.addPlot("indicator", { type: "Indicator", 
                vertical:false,
                values: <?php echo $this->masterChart_base_line_bed[0]['area'];     ?>,
                    //offset: { y: -10, x: 11 },
                 lineStroke: {
          color: "#ecf0f1",//"#ecf0f1",
          style: "line" 
         },
                 labels: true,
                // labelStyle:"inside",
            //maxBarSize: 35,
                //fontColor:"white",
                  precision: 1
                   //animate: { duration: 1000} 
      });
     //chart6.addPlot("grid", {type: "Grid"});
    chart6.addSeries("Master Bedroom", <?php echo   json_encode($this->masterChart_master_room_area,JSON_NUMERIC_CHECK); ?>, 

   {stroke: {

   color: "#242324"

  }// fill: "red"
  });

    var anim6a = new dc.action2d.Highlight(chart6, "default", {
    highlight: "#FF7900",
    duration: dur,
    easing:   dojo.fx.easing.cubicIn
   });
   var anim6b = new dc.action2d.Shake(chart6, "default");


   chart6.render();

        };
    dojo.addOnLoad(makeObjects);
  </script> 

1 个答案:

答案 0 :(得分:1)

尝试将其添加到HTML标题中:

<META HTTP-EQUIV="X-UA-Compatible" content="IE=edge" />

IE是一块垃圾......多年来给我带来的麻烦......