2016-08-01 104 views
0

我的x軸數據是過去24小時,我想標註小時。對於「0」的小時值,我想用更大的字體大小顯示它,並用Date標記它。有沒有什麼方法可以設置x軸的標籤樣式? 我的代碼如下:關於dojox圖表X軸標籤

<!DOCTYPE html> 
<html > 
<head> 


    <link rel="stylesheet" href="http://localhost/arcgis_js_api/library/3.14/3.14/dijit/themes/claro/claro.css"> 

    <script>var dojoConfig = { 
     parseOnLoad:true, 
     packages: [{ 
      "name": "myModules", 
      "location": location.pathname.replace(/\/[^/]+$/, "") + "/" 
     }] 
    }; 
    </script> 
    <script src="http://localhost/arcgis_js_api/library/3.14/3.14/init.js" data-dojo-config="isDebug: 1, async: 1, parseOnLoad: 1" charset="utf-8"></script> 
    <script> 
     require(["dojox/charting/Chart", "dojox/charting/axis2d/Default", "dojox/charting/plot2d/Lines", "dojo/ready"], 
       function(Chart, Default, Lines, ready){ 
        ready(function(){ 
         var chart1 = new Chart("simplechart", { 
          title: "壓力", 
          titlePos: "top"}); 
         chart1.addPlot("default", {type: Lines, labels: true,labelStyle: "outside", labelOffset: 25,Stroke:{color: "blue", width: 1},markers: true}); 
         chart1.addAxis("x",{ majorLabels: true, majorTicks: true, 
          minorLabels: true, minorTicks:true, minorTick:{length:1}, 
          microTicks: true, 
          majorTickStep:12, 
          minorTickStep:1, 

          labels: [{value: 1, text: "10"}, {value: 2, text: "11",length:"20"}, 
           {value: 3, text: "12"}, {value: 4, text: "0"}, 
           {value: 5, text: "May"}, {value: 6, text: "Jun"}, 
           {value: 7, text: "Jul"}, {value: 8, text: "Aug"}, 
           {value: 9, text: "Sep"}, {value: 10, text: "Oct"}, 
           {value: 11, text: "Nov"}, {value: 12, text: "Dec"}] 
         }); 

         chart1.addAxis("y", {vertical: true,microTickStep:1}); 
         chart1.addSeries("Series 1", [{x: 1, y: 5}, {x: 2, y: 1.7}, 
          {x: 3, y: 9}, {x: 4, y: 3}],{plot: "default", stroke: {color:"blue"}}); 
         chart1.render(); 
        }); 
       }); 
    </script> 
</head> 
<body class="claro"> 
<div id="simplechart" style="width: 250px; height: 150px; margin: 5px auto 0px auto;"></div> 
</body> 
</html> 

回答

0

您可以使用主題更改軸的樣式。如果你想爲不同的軸使用不同的主題軸的屬性。

this.addAxis("y", {type: "Wetland", 
        vertical: true, 
        } 
      ); 

其中溼地是道場/ DojoX中/圖表/主題的主題名稱 有很多主題那裏。但是,如果他們都不滿足你,你可以通過修改一些默認值來創建自己的主題。

只能在其中一個軸標籤上設置特定的樣式。即所有軸的標籤都具有相同的樣式。