我怎样才能建立一个没有在FusionCharts的JS填充multilevelpie图?

问题描述 投票:0回答:1

我建立FusionCharts的multilevelpie图。但巨大的凹痕出现。

500×500随着空间的减小,图形大大降低。 padding 1

100%×100%在做一个全尺寸图,缩进变得太大。 padding 2

当我降低图形的空间,图形变得太小。

我的代码:

    FusionCharts.ready(function(){
    var fusioncharts = new FusionCharts({
    type: 'multilevelpie',
    renderAt: 'chart-container',

    width: '500',
    height: '500',
    dataFormat: 'json',
    dataSource: {
        "chart": {
            "caption": "",
            "subcaption": "",
            "showPlotBorder": "1",
            "piefillalpha": "60",
            "pieborderthickness": "2",
            "hoverfillcolor": "#CCCCCC",
            "piebordercolor": "#FFFFFF",
            "hoverfillcolor": "#CCCCCC",
            "numberprefix": "#",
            "plottooltext": "$label",
            "theme": "fusion",
        },
        "category": {{ pie }},
    }
}
);
    fusioncharts.render();
    });

javascript frontend fusioncharts
1个回答
0
投票

您可以使用调整属性pieRadius在图表对象级别的馅饼外部分的大小,看看这个样本 -

FusionCharts.ready(function() {
  var topProductsChart = new FusionCharts({
    type: 'multilevelpie',
    renderAt: 'chart-container',
    id: "myChart",
    width: '400',
    height: '400',
    dataFormat: 'json',
    dataSource: {
      "chart": {
        "theme": "fusion",
        "caption": "Split of Top Products Sold",
        "subCaption": "Last Quarter",
        "captionFontSize": "14",
        "subcaptionFontSize": "14",
        "baseFontColor": "#333333",
        "baseFont": "Helvetica Neue,Arial",
        "basefontsize": "9",
        "subcaptionFontBold": "0",
        "bgColor": "#ffffff",
        "canvasBgColor": "#ffffff",
        "showBorder": "0",
        "showShadow": "0",
        "showCanvasBorder": "0",
        "pieFillAlpha": "60",
        "pieBorderThickness": "2",
        "hoverFillColor": "#cccccc",
        "pieBorderColor": "#ffffff",
        "useHoverColor": "1",
        "showValuesInTooltip": "1",
        "showPercentInTooltip": "0",
        "numberPrefix": "$",
        "plotTooltext": "$label, $$valueK, $percentValue",
        "pieRadius": "170"
      },
      "category": [{
        "label": "Sales by category",
        "color": "#ffffff",
        "value": "150",
        "category": [{
            "label": "Food & {br}Beverages",
            "color": "#f8bd19",
            "value": "55.5",
            "category": [{
                "label": "Breads",
                "color": "#f8bd19",
                "value": "11.1"
              },
              {
                "label": "Juice",
                "color": "#f8bd19",
                "value": "27.75"
              },
              {
                "label": "Noodles",
                "color": "#f8bd19",
                "value": "9.99"
              },
              {
                "label": "Seafood",
                "color": "#f8bd19",
                "value": "6.66"
              }
            ]
          },
          {
            "label": "Apparel &{br}Accessories",
            "color": "#e44a00",
            "value": "42",
            "category": [{
                "label": "Sun Glasses",
                "color": "#e44a00",
                "value": "10.08"
              },
              {
                "label": "Clothing",
                "color": "#e44a00",
                "value": "18.9"
              },
              {
                "label": "Handbags",
                "color": "#e44a00",
                "value": "6.3"
              },
              {
                "label": "Shoes",
                "color": "#e44a00",
                "value": "6.72"
              }
            ]
          },
          {
            "label": "Baby {br}Products",
            "color": "#008ee4",
            "value": "22.5",
            "category": [{
                "label": "Bath &{br}Grooming",
                "color": "#008ee4",
                "value": "9.45"
              },
              {
                "label": "Feeding",
                "color": "#008ee4",
                "value": "6.3"
              },
              {
                "label": "Diapers",
                "color": "#008ee4",
                "value": "6.75"
              }
            ]
          },
          {
            "label": "Electronics",
            "color": "#33bdda",
            "value": "30",
            "category": [{
                "label": "Laptops",
                "color": "#33bdda",
                "value": "8.1"
              },
              {
                "label": "Televisions",
                "color": "#33bdda",
                "value": "10.5"
              },
              {
                "label": "SmartPhones",
                "color": "#33bdda",
                "value": "11.4"
              }
            ]
          }
        ]
      }]
    }
  });

  topProductsChart.render();
});

这里有一个现场演示 - http://jsfiddle.net/cebu68vt/

© www.soinside.com 2019 - 2024. All rights reserved.