javascriptchartsdojodojox.charting

set background color in chart


I am using a theme, but i want to set background color around the chart to white or transparent or something.

I am trying this code:

  var myTheme =  dojox.charting.themes.PlotKit.orange;

  myTheme.fill= "white";

  chart10.setTheme(myTheme);


chart10.addPlot("default", {
    type: "Pie", 
    labelOffset: -30,
    radius: 150,
    startAngle: 45,
    font: "normal normal 10pt Tahoma",
    fontColor: "black",
    labelWiring: "grey",
    labelStyle: "columns",
    htmlLabels: true,
    plotarea: { fill: "#000" }
});

But this code didn't works, none alteration is visible.

How can i set the color background ?

enter image description here


Solution

  • I believe you have to set both the chart.fill and plotarea.fill properties.

      myTheme.chart.fill= "white";
      myTheme.plotarea.fill = "white";
    

    If you do console.debug(myTheme) you can inspect all the properties of the theme object. I usually have to experiment a little before I find the right ones.