Telerik Forums
UI for PHP Forum
1 answer
191 views

Is it possible to render chart as a svg, png or binary image by using kendo UI Chart PHP Class

I'm trying to find solution to generate charts from background php script, so any frontend charts with js and css don't work for me. I need to generate chart as an image and save it, just by running the script from background.

Georgi Denchev
Telerik team
 answered on 30 May 2022
1 answer
75 views

Hello!

I'm facing with a problem right now. 

I tried to add the legend for the pie and the donut, but unfortunately it doesn't work.

My first try was to add legend inside of chart like example below:

$chart = new \Kendo\Dataviz\UI\Chart('chart');
        $chart->dataSource($dataSource)
            ->autoBind(TRUE)
            ->tooltip($tooltip)
            ->addSeriesItem($seriesPieDonut)
            ->legend(array('visible' => true))
            ->seriesDefaults($seriesDefaults);

Also my second try was to add the legend into series like example below:

$seriesPieDonut = new \Kendo\Dataviz\UI\ChartSeriesItem();
        $seriesPieDonut->field('datapoint')->visibleInLegend('visible');

 

Unfortunately the result is the same.

Maybe you guys have a solution for thins situation. I will greatly appreciate! 

Thank you!

Yours,

Alexandru-Paul Ioneasa

Tsvetomir
Telerik team
 answered on 05 Dec 2019
7 answers
355 views

Hi there, can you guys help my to create select database where.... There is a code that working good.

require_once '../lib/DataSourceResult.php';
require_once '../lib/Kendo/Autoload.php';

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');

    $request = json_decode(file_get_contents('php://input'));

    $result = new DataSourceResult('mysql:host=localhost:3306 ;dbname=database_4', 'user', 'password');

    $type = $_GET['type'];

    $operation = $_GET['operation'];

    if ($type == "dependency") {
        $columns = array('ID', 'PredecessorID', 'SuccessorID', 'Type');

        $table = "GanttDependencies";
    } else {
        $columns = array('ID', 'ParentID', 'OrderID', 'name', 'start_date', 'due_date', 'progress', 'Expanded', 'Summary');

        $table = "GanttTasks";
    }

Is there any possible to put there a select with some conditions?

For example I would like to select all the records where id = 10.
Can you help my in this?

Valerius
Top achievements
Rank 1
 answered on 14 Nov 2017
1 answer
93 views

I have created a line chart with date axis. How can I set it zoomable?

 

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Telerik Line Chart</title>
    <link rel="stylesheet" href="TelerikPHPUI/styles/kendo.common.min.css" />
    <link rel="stylesheet" href="TelerikPHPUI/styles/kendo.default.min.css" />
    <script src="TelerikPHPUI/js/jquery.min.js"></script>
    <script src="TelerikPHPUI/js/kendo.all.min.js"></script>
    </head>
    <body>
        <?php
        require_once 'TelerikPHPUI/Kendo/Autoload.php';
        require_once 'TelerikPHPUI/chart_data.php';
         
        $data = array(
            array("date"=>"2015-09-08 09:25:24", "value"=>"61"),
            array("date"=>"2015-09-08 23:57:56", "value"=>"36"),
            array("date"=>"2015-09-08 12:31:30", "value"=>"7"),
            array("date"=>"2015-09-08 10:25:24", "value"=>"13"),
            array("date"=>"2015-09-08 14:35:34", "value"=>"70"),
            array("date"=>"2015-09-08 03:09:08", "value"=>"50"),
            array("date"=>"2015-09-08 13:34:33", "value"=>"78"),
            array("date"=>"2015-09-08 20:50:49", "value"=>"31"),
            array("date"=>"2015-09-08 06:15:14", "value"=>"68"),
            array("date"=>"2015-09-08 01:05:04", "value"=>"85"),
            array("date"=>"2015-09-08 17:43:42", "value"=>"6"),
            array("date"=>"2015-09-08 09:24:23", "value"=>"91"),
            array("date"=>"2015-09-08 05:14:13", "value"=>"69"),
            array("date"=>"2015-09-08 21:54:53", "value"=>"23"),
            array("date"=>"2015-09-08 05:14:13", "value"=>"57"),
            array("date"=>"2015-09-08 09:24:23", "value"=>"13"),
            array("date"=>"2015-09-08 20:52:51", "value"=>"50"),
            array("date"=>"2015-09-08 14:36:35", "value"=>"48"),
            array("date"=>"2015-09-08 21:52:51", "value"=>"79"),
            array("date"=>"2015-09-08 23:59:58", "value"=>"24")
        );
         
        $series = new \Kendo\Dataviz\UI\ChartSeriesItem();
        $series->type('line')
                        ->aggregate('avg')
                        ->field('value')
                        ->categoryField('date')
                        ->data($data)
                        ->style("smooth")
                        ->markers(array("visible"=>false))
                        ->name("adat");
         
        $valueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
        $valueAxis->labels(array('format'=>'{0} %'));
         
        $categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
        $categoryAxis->type('date')
                                 ->baseUnit("hours")
                                 ->labels(array('format' => 'yy MMM dd\nHH:mm', 'step'=>2));
         
        $tooltip = new \Kendo\Dataviz\UI\ChartTooltip();
        $tooltip->visible(true)
                        ->format('{0} %')
                        ->template('#=series.name# #=value# % (#=kendo.toString(category, "yyyy.MM.dd. HH:mm")#)');
         
        $chartArea = new \Kendo\Dataviz\UI\ChartArea();
        $chartArea->height(600);
         
        $chart = new \Kendo\Dataviz\UI\Chart('chart');
         
        $chart->title(array('text'=>'Title of chart'))
                    ->legend(array('position'=>'bottom'))
                    ->addSeriesItem($series)
                    ->addValueAxisItem($valueAxis)
                    ->addCategoryAxisItem($categoryAxis)
                    ->seriesDefaults(array('type'=>'line'))
                    ->chartArea($chartArea)
                    ->tooltip($tooltip);
 
        echo $chart->render();
        ?>
    </body>
</html>

Iliana Dyankova
Telerik team
 answered on 12 Sep 2015
1 answer
46 views

Hi,

I've been working with kendo for the past couple of weeks and it's really a great tool!

 

Now I received the request to give the graphs (bar char & pie) a more 3D look, is that possible with the kendo for PHP ?
I'm looking for a simple approach, like adding a stylesheet to mimic 3D or is there a parameter setting I missed ?

 

T. Tsonev
Telerik team
 answered on 18 Jun 2015
1 answer
53 views

Hi,

Another question from a kendo noob ...

I've set up a onclick event (bar graph) on the graphical bars generated by the graph

[code]->seriesClick('onNoteClick')[/code]

 The graph object is passed as a parameter of the function, so far so good.
Now what I'm looking for is the labelname that

 

Bernard
Top achievements
Rank 1
 answered on 13 May 2015
2 answers
156 views

I want to rotate the text of the X axis labels by 90 degrees

 In the docs I've found :

$labels = new \Kendo\Dataviz\UI\ChartXAxisItemLabels();
$labels->rotation(90);

 

Which I added before

$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->title(array('text' => 'Bar chart'))
      ->legend(array('position' => 'top'))
      ->addSeriesItem($arr[0],$arr[1],$arr[2],$arr[3],$arr[4])
      ->addValueAxisItem($valueAxis)
      ->addCategoryAxisItem($cateogrySeriesAxis)
      ->addCategoryAxisItem($categoryLabelsAxis)
      ->tooltip($tooltip)
      ->chartArea(array('background' => 'transparent'))
      ->seriesDefaults(array('type' => 'column'));
echo $chart->render();

 

 However, the changes are not applied.
I first thought I had to assign it to $chart (such as tooltip is done) but this leads to a blank page so I have no idea what I have to do with to make it work

Bernard
Top achievements
Rank 1
 answered on 11 May 2015
2 answers
78 views
I'm using Dataviz widgets in my application and need to export them to PDF and Excel files dynamically.I've seen the links for exporting charts in .NET
technology, but coudn't find any of the leads in PHP.I just need a lead or an example showing how to export charts and other Dataviz controls using
PHP.
Thanks for the Help.


T. Tsonev
Telerik team
 answered on 09 Aug 2013
3 answers
76 views
I'm having some trouble getting my series points to separate by 'Category'. Visual view is attached, code and data example is below.

It looks like the last category in the list overwrites the one before it. (in this case 'comments' overwrites 'views')

Thanks for your help.
$transport = new \Kendo\Data\DataSourceTransport();
            $transport->read( array(
                'url' => '/projects/stats/data/' . $id,
                'type' => 'POST',
                'dataType' => 'json',
                'data' => array( 'datelow' => $dateLow, 'datehigh' => $dateHigh, 'category' => $category ),
            ));
             
             
            $series = new \Kendo\Dataviz\UI\ChartSeriesItem();
            $series->type('line')
                   ->field('count')
                   ->name('count');
                  //->aggregate('count');
                   //->groupNameTemplate('#= group.value #')
                   
             
            $valueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
            $valueAxis->labels(array(
                            'format' => '{0}',
                            'skip' => 0,
                            'step' => 2
                      ));
            $valueAxis->min(0);
            //$valueAxis->max(100);
            //$valueAxis->majorUnit(10);
             
            $categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
            $categoryAxis->field('timestamp');
            //$categoryAxis->type('date');
              
             
            $tooltip = new \Kendo\Dataviz\UI\ChartTooltip();
            $tooltip->visible(true)
                    ->format('{0}%')
                    ->color('#fff')
                    ->template('#= series.name # : #= value #');
             
             
            // Configure the model
            $model = new \Kendo\Data\DataSourceSchemaModel();
            $model->addField(array('field' => 'timestamp', 'type' => 'date'));
             
            $schema = new \Kendo\Data\DataSourceSchema();
            $schema->model($model);
         
            $dataSource = new \Kendo\Data\DataSource();
             
            $dataSource->error('function(e) { console.log(e); }');
            $dataSource->transport($transport)
                       ->schema($schema)
                       ->addGroupItem(array('field' => 'category'));
                                            
            $chart = new \Kendo\Dataviz\UI\Chart('chart');          
             
                 
            $chart->title(array('text' => 'Episode Statistics'))
                  ->dataSource($dataSource)
                  ->legend(array('position' => 'bottom'))
                  ->addSeriesItem($series)
                  ->addValueAxisItem($valueAxis)
                  ->addCategoryAxisItem($categoryAxis)
                  ->seriesDefaults(array('type' => 'area'))
                  ->tooltip($tooltip)
                  ->transitions(false);
[
{
id: "72",
episode: "9",
user: "7",
timestamp: "2013-04-19",
category: "views",
count: 1
},
{
id: "71",
episode: "9",
user: "7",
timestamp: "2013-04-19",
category: "views",
count: 1
},
{
id: "73",
episode: "9",
user: "8",
timestamp: "2013-04-19",
category: "views",
count: 1
},
{
id: "74",
episode: "9",
user: "7",
timestamp: "2013-04-19",
category: "views",
count: 1
},
{
id: "78",
episode: "9",
user: "9",
timestamp: "2013-04-19",
category: "views",
count: 1
},
{
id: "75",
episode: "9",
user: "9",
timestamp: "2013-04-19",
category: "views",
count: 1
},
{
id: "70",
episode: "9",
user: "8",
timestamp: "2013-04-19",
category: "views",
count: 1
},
{
id: "69",
episode: "9",
user: "7",
timestamp: "2013-04-19",
category: "views",
count: 1
},
{
id: "64",
episode: "9",
user: "7",
timestamp: "2013-04-19",
category: "views",
count: 1
},
{
id: "3",
episode: "9",
user: "7",
parent: "0",
comment: "Writing another comment",
editcount: "0",
timestamp: "2013-04-19",
flagged: "0",
category: "comments",
count: 1
},
{
id: "65",
episode: "9",
user: "7",
timestamp: "2013-04-19",
category: "views",
count: 1
},
{
id: "66",
episode: "9",
user: "7",
timestamp: "2013-04-19",
category: "views",
count: 1
},
{
id: "68",
episode: "9",
user: "7",
timestamp: "2013-04-19",
category: "views",
count: 1
},
{
id: "67",
episode: "9",
user: "7",
timestamp: "2013-04-19",
category: "views",
count: 1
},
{
id: "2",
episode: "9",
user: "7",
parent: "0",
comment: "A really insightful piece.",
editcount: "0",
timestamp: "2013-04-19",
flagged: "0",
category: "comments",
count: 1
}
]
Mark
Top achievements
Rank 1
 answered on 24 Apr 2013
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?