2012-01-09 2 views
6

KendoUI円グラフのサイズをどのように縮小しますか?私は次の設定を使用して円グラフを使用しています。マージンを1ピクセルに、パディングを1ピクセルに設定しましたが、円グラフのレンダリング方法には何の影響もないようです。私はタイトルはないが、まだタイトルのためのスペースがある。私はグラフの上部と凡例と実際のグラフとの間のスペースの間のスペースを減らすことができるようにしたい。剣道パイのグラフを小さくするには?

マイ設定:

jQuery("#chart").kendoChart({ 
//    theme: jQuery(document).data("kendoSkin") || "Metro", 
      legend: { 
       position: "bottom", 
       padding: 1, 
       margin: 1 
      }, 
      seriesDefaults: { 
       labels: { 
        visible: true, 
        template: "${ value }%" 
       } 
      }, 
      dataSource: { 
       data: <%=ChartData%> 
      }, 
      series: [{ 
       type: "pie", 
       field: "percentage", 
       categoryField: "source", 
       explodeField: "explode" 
      }], 
      tooltip: { 
       visible: false, 
       template: "${ category } - ${ value }%" 
      }, 
      title: { padding: 1, margin: 1 }, 
      seriesColors: ["#d15400", "#19277e", "#e2935e", "#d2d2d2"], 
      chartArea: { margin: 1 }, 
      plotArea: { margin: 1 } 
     }); 
+0

..円グラフのサイズを変更するのChartAreaでプロパティを定義しますか?たぶんたった一行ですか? –

答えて

17

円グラフは、デフォルトで60PX paddingを持っています。円グラフの周りのスペースを減らす必要がある場合は、そのパディングを変更する必要があります。ここ

... 
series: [{ 
    type: "pie", 
    field: "percentage", 
    categoryField: "source", 
    explodeField: "explode", 
    padding: 0 
}] 
... 
+0

真剣に、これをありがとう! – zeroflaw

2
$("#chart").kendoChart({ 
    theme: $(document).data("kendoSkin") || "default", 
    title: { 
     text: "Samplet" 
    }, 
    seriesDefaults: { 
     labels: { 
      template: "#= kendo.format('{0:P}', percentage)#", 
      visible: true 
     } 
    },chartArea: { 
    width: 300, 
    height: 300 
}, 
    series: [{ 
     type: "pie", 
     data: [{ 
      category: "Quality", 
      value: 80}, 
     { 
      category: "Time", 
      value: 20}, 
     { 
      category: "Cost", 
      value: 40}]}], 
    tooltip: { 
     visible: true, 
     template: "#= kendo.format('{0:P}', percentage)#" 
    } 

}); 

私たちは、あなたがあなたのJSONデータの一部を共有できる

関連する問題