KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Legend position / scales y and x axes and other chart settings in dashboard #1926

Closed Andre Van Der Walt opened this topic on on Feb 26, 2021 - 4 comments

Andre Van Der Walt commented on Feb 26, 2021

Hi,

Please advise how to change legend position and other chart settings in dashboard framework using the default google charts?

Thank you,

KoolReport commented on Mar 1, 2021

Definitely you can do so, please use the "options" property, for example

class  MyChart extends ColumnChart
{
    protected function onCreated()
    {
        $this->options([
            "legend"=>[
                "position"=>0
            ]
        ]);
    }
}

If you want to set it from outside (inside Dashboard), you can do

MyChart::create()->options([
            "legend"=>[
                "position"=>0
            ]
])

Let us know if you need further assistance.

Andre Van Der Walt commented on Mar 3, 2021

Hi,

Thank you, how do you hide the legend and how to change chart color? I tried this without success:

protected function onCreated()
    {
        $this->options([
            "legend"=>[
                "display"=>false
            ]
        ]);
    }
protected function onInit()
    {
        $this
            ->height("150px")
            ->colorScheme("#36a8e1");
    }

Thank you

KoolReport commented on Mar 3, 2021

You do this to turn off legend.

"position"=>"none"

for the colorScheme, it receive array, so it will be:

->colorScheme(["#36a8e1"]);

Hope that helps.

Andre Van Der Walt commented on Mar 3, 2021

Thank you

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
help needed
solved

Dashboard