KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.

Use of D3 to create a column chart #1613

Open Richb201 opened this topic on on Sep 8 - 1 comments

Richb201 commented on Sep 8

I am trying to follow your documentation (examples really!) and in looking at D3, your code example is below. Notice how it uses dataSource instead of dataStore? Is this correct? All the other packages use dataStores. And if not, where do I specify the table I want to use?

    <?php
    ColumnChart::create(array(
        "dataSource"=>array(
            array("category"=>"Books","sale"=>32000,"number"=>1700,),
            array("category"=>"Accessories","sale"=>43000,"number"=>2100),
            array("category"=>"Phones","sale"=>54000,"number"=>3200),
            array("category"=>"Movies","sale"=>23000,"number"=>9000),
            array("category"=>"Others","sale"=>12000,"number"=>5300),
        ),
        "columns"=>array(
            "category",
            "sale"=>array(
                "label"=>"Sale",
                "type"=>"number",
                "prefix"=>"$"
            ),
            "number"=>array(
                "label"=>"Cost",
                "type"=>"number",
                "prefix"=>"$",
                "axis"=>"y2"
            ),
        ),
        "yAxis"=>array(
            "prefix"=>"$"
        ),
        "dualAxis"=>true
    ));
    ?>
David Winterburn commented on Sep 9

You can use "dataSource" for D3's chart as well as other widgets. This property accepts various type of data sources including array, function, and datastore.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

None