KoolReport's Forum

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

Is it possible to show HTML tooltip for Google Charts #1766

Open Venom opened this topic on on Dec 16, 2020 - 2 comments

Venom commented on Dec 16, 2020

I want to customize the tooltip format in tooltip option for columns. Instead of showing the plain text, I want to display HTML text.

`

$totalToolTipFunc = function($row)

    {   $col = $row['count(Quotation Number)'];
        $total = number_format($row['sum(Quotation Total)']);
        return '<b>'.$col.' - $'.$total.'</b>';
    };

ColumnChart::create(array(

        "title"=>"Quotation Report",
        "dataSource"=>$this->dataStore("vqDS"),
        "columns"=>array(
            "Month",
            "sum(Quotation Total)"=>array("label"=>"Total",
            "type"=>"number","prefix"=>"$",
            "tooltip"=>$totalToolTipFunc),
            ),
            
    ));

KoolReport commented on Dec 16, 2020

You add the following options:

ColumnChart::create(
    "options"=>array(
        "tooltip"=>array(
            "isHtml"=>true
        )
    )
);
Venom commented on Dec 16, 2020

I am not sure that I put the wrong place or not, it could not show the html tool tips.

I have no idea how to setup the tool tips like those in Google Charts Bar Charts with Koolreport, is there any samples for reference? Google Chart Tooltips


      $tooltipFunc = function($row)
        {   $col = $row['sum(Quotation Confirm)'];
            $confirm = number_format($row['sum(Confirm Amount)']);
            return $col.' - $'.$confirm;
        };

        $totalToolTipFunc = function($row)
        {   $col = $row['count(Quotation Number)'];
            $total = number_format($row['sum(Quotation Total)']);
            return '<div>'.$col.' - $'.$total.'</div>';
        };

        ColumnChart::create(array(
            "options"=>array(
                "tooltip"=>array(
                    "isHtml"=>true
                )
                ),
            "title"=>"Quotation Report",
            "dataSource"=>$this->dataStore("vqDS"),
            "columns"=>array(
                "Month",
                "sum(Confirm Amount)"=>array(
                "label"=>"Confirm Amount",
                "type"=>"number","prefix"=>"$",
                "tooltip"=>$tooltipFunc),
                "sum(Quotation Total)"=>array("label"=>"Total",
                "type"=>"number","prefix"=>"$",
                "tooltip"=>$totalToolTipFunc),
                ),
              
                
        ));

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

None