koolreport
koolreport copied to clipboard
GoogleChart: get type from column definition to support date string representation
You only take the label for the column defintion in Chart::prepareData(), so you cannot support date string representation for hAxis and therefore no trendlines.
With this patch, you will also respect the type definition from columns, allowing us to format datetime as date string representation, which is necessary for trendlines on datetime based datasets.
Index: vendor/koolphp/koolreport/src/widgets/google/Chart.php
===================================================================
--- vendor/koolphp/koolreport/src/widgets/google/Chart.php (revision 4508)
+++ vendor/koolphp/koolreport/src/widgets/google/Chart.php (working copy)
@@ -183,7 +183,11 @@
$header = array();
$columnExtraRoles = array("annotation", "annotationText", "certainty", "emphasis", "interval", "scope", "style", "tooltip");
foreach ($columns as $cKey => $cSetting) {
- array_push($header, "" . Utility::get($cSetting, "label", $cKey));
+ $header_column = [ 'label' => "" . Utility::get($cSetting, "label", $cKey) ];
+ if ($type = Utility::get($cSetting, "type", $cKey)) {
+ $header_column['type'] = $type;
+ }
+ array_push($header, $header_column);
foreach ($columnExtraRoles as $cRole) {
if (isset($cSetting[$cRole])) {
array_push(
Thank you very much!