PieChart

Overview #

Pie charts are generally used to show percentage or proportional data and usually the percentage represented by each category is provided next to the corresponding slice of pie. Pie charts are good for displaying data for around 6 categories or fewer.

\koolreport\d3\PieChart::create(array(
    "dataStore"=>array(
        array("category"=>"Books","sale"=>90,"cost"=>20000,"profit"=>12000),
        array("category"=>"Accessories","sale"=>43000,"cost"=>36000,"profit"=>7000),
        array("category"=>"Phones","sale"=>54000,"cost"=>39000,"profit"=>15000),
        array("category"=>"Movies","sale"=>23000,"cost"=>18000,"profit"=>5000),
        array("category"=>"Others","sale"=>12000,"cost"=>6000,"profit"=>6000),
    ),
    "columns"=>array(
        "category",
        "cost"
    ),
    "label"=>array(
        "use"=>"ratio",
    ),
    "tooltip"=>array(
        "use"=>"value",
        "prefix"=>"$"
    )
));

Label #

This is the settings for label appearing on each pie, you may hide/show the label. You also can choose between "ratio" or "value" to be shown. There are options for you to format the number on label such as decimals, decPoint, thousandSep, prefix and suffix.

PieChart::create(array(
    ...
    "label"=>array(
        "show"=>true, // Whether to show label
        "use"=>"ratio", // Accept "ratio" or "value" to display whether the real value or calculated ratio
        "decimals"=>2,
        "decPoint"=>".",
        "thousandSep"=>",",
        "prefix"=>"$",
        "suffix"=>"",
    )
));

Tooltip #

This is the settings for tooltip appearing on each pie when mouse is over, you may hide/show the tooltip. You also can choose between "ratio" or "value" to be shown. There are options for you to format the number on label such as decimals, decPoint, thousandSep, prefix and suffix.

PieChart::create(array(
    ...
    "tooltip"=>array(
        "show"=>true, // Whether to show label
        "use"=>"ratio", // Accept "ratio" or "value" to display whether the real value or calculated ratio
        "decimals"=>2,
        "decPoint"=>".",
        "thousandSep"=>",",
        "prefix"=>"$",
        "suffix"=>"",
    )
));