Merge pull request #4266 from MrPetovan/task/4116-move-chartjs-to-composer

Move Chart.js to Composer
This commit is contained in:
Tobias Diekershoff 2018-01-19 15:52:25 +01:00 committed by GitHub
commit 5e42577944
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 130 additions and 80 deletions

View File

@ -27,7 +27,8 @@
"fxp/composer-asset-plugin": "~1.3",
"bower-asset/base64": "^1.0",
"npm-asset/jquery": "^1.11.2",
"npm-asset/jquery-colorbox": "^1.6"
"npm-asset/jquery-colorbox": "^1.6",
"bower-asset/Chart-js": "^2.7"
},
"repositories": [
{

34
composer.lock generated
View File

@ -4,8 +4,40 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "228247829bf46d313ca451f94b87c7ef",
"content-hash": "6cf3b635594e443a7268a3bd9100d62d",
"packages": [
{
"name": "bower-asset/Chart-js",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/chartjs/Chart.js.git",
"reference": "0fead21939b92c15093c1b7d5ee2627fb5900fff"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/chartjs/Chart.js/zipball/0fead21939b92c15093c1b7d5ee2627fb5900fff",
"reference": "0fead21939b92c15093c1b7d5ee2627fb5900fff",
"shasum": ""
},
"type": "bower-asset-library",
"extra": {
"bower-asset-main": "./dist/Chart.js",
"bower-asset-ignore": [
".github",
".codeclimate.yml",
".gitignore",
".npmignore",
".travis.yml",
"scripts"
]
},
"license": [
"MIT"
],
"description": "Simple HTML5 charts using the canvas element.",
"time": "2017-10-28T15:01:52+00:00"
},
{
"name": "bower-asset/base64",
"version": "1.0.1",

File diff suppressed because one or more lines are too long

View File

@ -1,7 +0,0 @@
Copyright (c) 2013-2015 Nick Downie
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,20 +0,0 @@
# Chart.js
[![Build Status](https://travis-ci.org/nnnick/Chart.js.svg?branch=master)](https://travis-ci.org/nnnick/Chart.js) [![Code Climate](https://codeclimate.com/github/nnnick/Chart.js/badges/gpa.svg)](https://codeclimate.com/github/nnnick/Chart.js)
*Simple HTML5 Charts using the canvas element* [chartjs.org](http://www.chartjs.org)
## Documentation
You can find documentation at [chartjs.org/docs](http://www.chartjs.org/docs/). The markdown files that build the site are available under `/docs`. Please note - in some of the json examples of configuration you might notice some liquid tags - this is just for the generating the site html, please disregard.
## Bugs, issues and contributing
Before submitting an issue or a pull request to the project, please take a moment to look over the [contributing guidelines](https://github.com/nnnick/Chart.js/blob/master/CONTRIBUTING.md) first.
For support using Chart.js, please post questions with the [`chartjs` tag on Stack Overflow](http://stackoverflow.com/questions/tagged/chartjs).
## License
Chart.js is available under the [MIT license](http://opensource.org/licenses/MIT).

View File

@ -399,14 +399,9 @@ a {
color: #00a700;
}
.federation-graph {
width: 400px;
height: 400px;
float: right;
margin: 20px;
margin: 0 auto;
}
.federation-network-graph {
width: 240px;
height: 240px;
float: left;
margin: 20px;
}

View File

@ -1,57 +1,117 @@
<script src="{{$baseurl}}/library/Chart.js-1.0.2/Chart.min.js"></script>
<canvas id="FederationChart" class="federation-graph"></canvas>
<script src="{{$baseurl}}/vendor/asset/Chart-js/dist/Chart.min.js"></script>
<canvas id="FederationChart" class="federation-graph" width="400" height="400"></canvas>
<div id="adminpage">
<h1>{{$title}} - {{$page}}</h1>
<p>{{$intro}}</p>
{{if not $autoactive}}
<p class="error-message">{{$hint}}</p>
<p class="error-message">{{$hint}}</p>
{{/if}}
<p>{{$legendtext}}
<p>{{$legendtext}}</p>
<ul>
{{foreach $counts as $c}}
{{if $c[0]['total'] > 0}}
<li>{{$c[0]['platform']}} ({{$c[0]['total']}}/{{$c[0]['users']}})</li>
{{/if}}
{{/foreach}}
{{foreach $counts as $c}}
{{if $c[0]['total'] > 0}}
<li>{{$c[0]['platform']}} ({{$c[0]['total']}}/{{$c[0]['users']}})</li>
{{/if}}
{{/foreach}}
</ul>
</p>
</div>
<script>
var FedData = [
var FedData = {
datasets: [{
data: [
{{foreach $counts as $c}}
{{$c[0]['total']}},
{{/foreach}}
],
backgroundColor: [
{{foreach $counts as $c}}
{ value: {{$c[0]['total']}}, label: "{{$c[0]['platform']}}", color: '{{$c[3]}}', highlight: "#EE90A1", },
'{{$c[3]}}',
{{/foreach}}
];
],
hoverBackgroundColor: [
{{foreach $counts as $c}}
'#EE90A1',
{{/foreach}}
]
}],
labels: [
{{foreach $counts as $c}}
"{{$c[0]['platform']}}",
{{/foreach}}
]
};
var ctx = document.getElementById("FederationChart").getContext("2d");
var myDoughnutChart = new Chart(ctx).Doughnut(FedData, { animateRotate : false, });
var myDoughnutChart = new Chart(ctx, {
type: 'doughnut',
data: FedData,
options: {
legend: {display: false},
animation: {animateRotate: false},
responsive: false
}
});
</script>
<table id="federation-stats">
{{foreach $counts as $c}}
{{if $c[0]['total'] > 0}}
<tr>
<th>{{$c[0]['platform']}}</th>
<th><strong>{{$c[0]['total']}}</strong></td>
<td>{{$c[0]['network']}}</td>
<th>{{$c[0]['platform']}}</th>
<th><strong>{{$c[0]['total']}}</strong></td>
<td>{{$c[0]['network']}}</td>
</tr>
<tr>
<td colspan="3" class="federation-data">
<canvas id="{{$c[2]}}Chart" class="federation-network-graph"></canvas>
<script>
var {{$c[2]}}data = [
{{foreach $c[1] as $v}}
{ value: {{$v['total']}}, label: '{{$v['version']}}', color: "{{$c[3]}}", highlight: "#EE90A1",},
{{/foreach}}
];
var ctx = document.getElementById("{{$c[2]}}Chart").getContext("2d");
var my{{$c[2]}}DoughnutChart = new Chart(ctx).Doughnut({{$c[2]}}data, {animateRotate : false,});
</script>
<ul class="federation-stats">
{{foreach $c[1] as $v}}
<li>{{if ($c[0]['platform']==='Friendica' and $version===$v['version']) }}<span class="version-match">{{$v['version']}}</span>{{else}}{{$v['version']}}{{/if}} ({{$v['total']}})</li>
{{/foreach}}
</ul>
</td>
<td colspan="3" class="federation-data">
<canvas id="{{$c[2]}}Chart" class="federation-network-graph" width="240" height="240"></canvas>
<script>
var {{$c[2]}}data = {
datasets: [{
data: [
{{foreach $c[1] as $v}}
{{$v['total']}},
{{/foreach}}
],
backgroundColor: [
{{foreach $c[1] as $v}}
'{{$c[3]}}',
{{/foreach}}
],
hoverBackgroundColor: [
{{foreach $c[1] as $v}}
'#EE90A1',
{{/foreach}}
]
}],
labels: [
{{foreach $c[1] as $v}}
'{{$v['version']}}',
{{/foreach}}
]
};
var ctx = document.getElementById("{{$c[2]}}Chart").getContext("2d");
var my{{$c[2]}}DoughnutChart = new Chart(ctx, {
type: 'doughnut',
data: {{$c[2]}}data,
options: {
legend: {display: false},
animation: {animateRotate: false},
responsive: false
}
});
</script>
<ul class="federation-stats">
{{foreach $c[1] as $v}}
<li>
{{if ($c[0]['platform']==='Friendica' and $version===$v['version']) }}
<span class="version-match">{{$v['version']}}</span>
{{else}}
{{$v['version']}}
{{/if}}
({{$v['total']}})
</li>
{{/foreach}}
</ul>
</td>
</tr>
{{/if}}
{{/foreach}}