ejdamm / chart.js-php Goto Github PK
View Code? Open in Web Editor NEWA PHP wrapper for chartjs/Chart.js
License: MIT License
A PHP wrapper for chartjs/Chart.js
License: MIT License
Hi,
I tired to set border width by set option bellow
array('data' => $data, 'label' =>'Jumlah')+$colors[$color_index], 'borderwidth'=>1,
);
Then i got this link : https://jsfiddle.net/kewmh8w0/ but confuse to implement in your code framework
Thanks in advance
Hi,
I tried to download this code. But get error : Warning: require(../vendor/autoload.php): failed to open stream: No such file or directory . I can not found folder vendor and autoload.php
thanks,
jajas
Are you able to display multiple charts on the same page?
Hi,
I tried what you suggest to me for option in chart js, like bellow:
$options = array(
'scales' => array(
'yAxes' => array(
array(
'scaleLabel' => array(
'display' => true,
'labelString' => 'Time in Seconds',
'fontColor' => 'red'
)
)
)
)
);
and it woks. Thanks. buat i tried to add new option as follow to add legend but it does not work.
$options = array(
'scales' => array(
'yAxes' => array(
array(
'scaleLabel' => array(
'display' => true,
'labelString' => '',
'fontColor' => 'red',
'responsive' => false
)
)
)
)
'legend'=> array (
'horizontalAlign'=>'left', // "center" , "right"
'verticalAlign'=>'center', // "top" , "bottom"
'fontSize' =>'15'
)
);
need your advice.
Hi,
i tried to add thousand separator to my chart but still got error. bellow is my code using callback function but it doesn't work. need your help for this issue.
$options = array(
'responsive' => true,
'callbacks'=>array(
'label'=>function (tooltipItems, data) (
return data.datasets[tooltipItems.datasetIndex].label + ' : ' + tooltipItems.yLabel.toLocaleString();
)
)
'scales' => array(
'yAxes' => array(
array(
'scaleLabel' => array(
'display' => $showYaxes,
'labelString' =>$yaxeslabel,
'fontSize' =>10,
'fontStyle'=>'bold',
'borderWidth'=>1,
),
'ticks'=>array(
'beginAtZero'=> true,
)
)
),
'xAxes'=> array(
array(
'gridLines'=>array(/*
'zeroLineColor'=> "black",
'zeroLineWidth'=> 2*/
'display'=> true
),
'ticks'=>array(
'autoSkip'=>false,
'maxRotation'=> 30,
'minRotation'=> 30,
),
'scaleLabel'=>array(
'display'=> false,
'fontSize'=>16,
'labelString'=> $chartTitle
)
)
)
),
'legend' => array (
'display' => $displayLegend,
'position' => $legendPos,
'labels' => array (
'fontSize' => 12,
'usePointStyle'=> true,
)
),
'title'=>array (
'display'=>true,
'text'=> $chartTitle,
'fontSize' => 12,
'position'=>$titlePos
)
);
Thanks,
Jajas
This class is really helpful but I am doing view stats and some days there will be 0 views so how do i make it so that it does not just skip the date and says 0.
Here is an example in months of what i mean:
jan, feb, apr, jun, jul, aug, sep, nov, dec
it missed march,may & october so basically how to I make it so that it does not miss a few months and shows them as 0 instead of not showing them at all. Thanks
Also i have set it to always begin at 0 but for some reason it is not. Why could this be? Thanks
$viewsGraph = [
'labels' => ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
'datasets' => [[
'data' =>[8, 7, 8, 9, 6],
'backgroundColor' => '#007bff',
'borderColor' => '#005cbf',
'label' => 'Weekly Views'
]]
];
$options = [
'responsive' => true,
'scales' => [[
'yAxes' => [
'ticks' => [
'beginAtZero' => true
]
]
]]
];
$attributes = ['id' => 'example', 'width' => 500, 'height' => 200];
$Line = new ChartJS('bar', $viewsGraph, $options, $attributes);
This is the html side:
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.bundle.min.js"></script>
<script src="http://localhost/new/js/driver.js"></script>
<script>
(function() {
loadChartJsPhp();
})();
</script>
See PR #9
Hello, great work on this PHP class to help get others up and running faster. Looking over the class and would like to pass in a callback.
Any ideas on how this could be incorporated?
jtblin/angular-chart.js#33
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.