KoolReport's Forum

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

Package D3 with date and time #1123

Closed benoit opened this topic on on Oct 10, 2019 - 2 comments

benoit commented on Oct 10, 2019

Hello Koolreport,

I use the new D3 package. I need to change the xFormat to work with date and time.

<?php
    SplineChart::create(array(
        "dataSource"=>array(
            array("date"=>"2018-09-01 22:10:00","temp"=>17.9),
            array("date"=>"2018-09-02 22:11:00","temp"=>18.1),
            array("date"=>"2018-09-04 22:12:00","temp"=>18.3),
            array("date"=>"2018-09-05 22:13:00","temp"=>17.8),
            array("date"=>"2018-09-09 22:14:00","temp"=>18.0),
        ),
        "columns"=>array(
            "date"=>array(
                "type"=>"date",
                "xFormat"=>"%Y-%m-%d %H:%i:%s",
                "xDisplayFormat"=>"%d.%m.%Y %H:%i:%s"
            ),
            "temp"=>array(
                "label"=>"R30P_S3",
                "type"=>"number",
                "decimals"=>1,
                "suffix"=>"°C" 
            ),
        )  

if I use "xFormat"=>"%Y-%m-%d %H:%i:%s" it doest work

Do you have a solution for that?.

Thank you in advance

KoolReport commented on Oct 12, 2019

It should be:

                    "type"=>"datetime",
                    "xFormat"=>"%Y-%m-%d %H:%I:%S",
                    "xDisplayFormat"=>"%d.%m.%Y %H:%I:%S"

please make the I and S capitalize.

Here is the documentation of the date format.

benoit commented on Oct 12, 2019

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
solved

None