KoolReport's Forum

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

Hyperlinks in google BarChart #2566

Open Michael Boccardi opened this topic on on Feb 10, 2022 - 2 comments

Michael Boccardi commented on Feb 10, 2022

Hello, I want to add a link in the chart bar when click the bar to a particular page depending on witch bar was clicked. I don't have a clue how can add hyperlinks in the chart bar

I have this implemented

https://www.koolreport.com/docs/google_charts/bar_chart/

BarChart::create(array(
                        "title"=>"Total by User",
                        "options" => array(
                            "hAxis" => array( "format" => "0" ), 
                        ),
                        "dataSource"=>$this->dataStore("s_chart"),
                        "columns"=>array(
                            "account",
                            "Total"=>array("label"=>"Total Amount","decimals"=>0,"type"=>"number"),
                        )
                    ));

Thanks

Sebastian Morales commented on Feb 10, 2022

Michael, you could make use of Google Bar Chart's item select event to open a new link when a user clicks on a bar/column:

https://www.koolreport.com/docs/google_charts/overview/#client-events-itemselect

ColumnChart::create(array(
    ...
    "clientEvents"=>array(
        "itemSelect"=>"function(params){
            console.log(params);
            console.log(params.selectedValue);
            var url = ...; // create url from params
            window.open(url, '_blank').focus();
        }",
    )
));
Michael Boccardi commented on Feb 10, 2022

Thanks, that works!!!

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
solved

None