This commit is contained in:
zhuzichu 2023-12-05 11:42:21 +08:00
parent 711411f6a8
commit d255f5881e
12 changed files with 13490 additions and 12854 deletions

View File

@ -190,5 +190,12 @@
<file>qml/global/Lang.qml</file> <file>qml/global/Lang.qml</file>
<file>qml/page/T_Network.qml</file> <file>qml/page/T_Network.qml</file>
<file>qml/page/T_ShortcutPicker.qml</file> <file>qml/page/T_ShortcutPicker.qml</file>
<file>qml/chart/T_BarChart.qml</file>
<file>qml/chart/T_LineChart.qml</file>
<file>qml/chart/T_PieChart.qml</file>
<file>qml/chart/T_RadarChart.qml</file>
<file>qml/chart/T_ScatterChart.qml</file>
<file>qml/chart/T_BubbleChart.qml</file>
<file>qml/chart/T_PolarAreaChart.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -0,0 +1,73 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
import "qrc:///example/qml/component"
import "../component"
FluScrollablePage{
title:"Bar Chart"
FluArea{
width: 500
height: 370
paddings: 10
Layout.topMargin: 20
FluChart{
anchors.fill: parent
chartType: 'bar'
chartData: { return {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [{
label: 'My First Dataset',
data: [65, 59, 80, 81, 56, 55, 40],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(255, 159, 64, 0.2)',
'rgba(255, 205, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(201, 203, 207, 0.2)'
],
borderColor: [
'rgb(255, 99, 132)',
'rgb(255, 159, 64)',
'rgb(255, 205, 86)',
'rgb(75, 192, 192)',
'rgb(54, 162, 235)',
'rgb(153, 102, 255)',
'rgb(201, 203, 207)'
],
borderWidth: 1
}]
}
}
chartOptions: { return {
maintainAspectRatio: false,
title: {
display: true,
text: 'Chart.js Bar Chart - Stacked'
},
tooltips: {
mode: 'index',
intersect: false
},
responsive: true,
scales: {
xAxes: [{
stacked: true,
}],
yAxes: [{
stacked: true
}]
}
}
}
}
}
}

View File

@ -0,0 +1,75 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
import "qrc:///example/qml/component"
import "../component"
FluScrollablePage{
title:"Bubble Chart"
function randomScalingFactor() {
return Math.random().toFixed(1);
}
FluArea{
height: 370
width: 500
paddings: 10
Layout.topMargin: 20
FluChart{
anchors.fill: parent
chartType: 'bubble'
chartData: {
return {
datasets: [{
label: 'First Dataset',
data: [{
x: 20,
y: 30,
r: 15
}, {
x: 12,
y: 70,
r: 20
}, {
x: 11,
y: 28,
r: 8
}, {
x: 9,
y: 28,
r: 10
}, {
x: 43,
y: 7,
r: 14
}, {
x: 22,
y: 22,
r: 12
}, {
x: 40,
y: 10,
r: 10
}],
backgroundColor: 'rgb(255, 99, 132)'
}]
}}
chartOptions: {return {
maintainAspectRatio: false,
responsive: true,
hoverMode: 'nearest',
intersect: true,
title: {
display: true,
text: 'Chart.js Bubble Chart - Multi Axis'
}
}
}
}
}
}

View File

@ -0,0 +1,46 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
import "qrc:///example/qml/component"
import "../component"
FluScrollablePage{
title:"Line Chart"
FluArea{
width: 500
height: 370
paddings: 10
Layout.topMargin: 20
FluChart{
anchors.fill: parent
chartType: 'line'
chartData: { return {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [{
label: 'My First Dataset',
data: [65, 59, 80, 81, 56, 55, 40],
fill: false,
borderColor: 'rgb(75, 192, 192)',
tension: 0.1
}]
}
}
chartOptions: { return {
maintainAspectRatio: false,
title: {
display: true,
text: 'Chart.js Line Chart - Stacked'
},
tooltips: {
mode: 'index',
intersect: false
}
}
}
}
}
}

View File

@ -0,0 +1,94 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
import "qrc:///example/qml/component"
import "../component"
FluScrollablePage{
title:"Doughnut and Pie Chart"
FluArea{
width: 500
height: 370
paddings: 10
Layout.topMargin: 20
FluChart{
anchors.fill: parent
chartType: "doughnut"
chartData: { return {
labels: [
'Red',
'Blue',
'Yellow'
],
datasets: [{
label: 'My First Dataset',
data: [300, 50, 100],
backgroundColor: [
'rgb(255, 99, 132)',
'rgb(54, 162, 235)',
'rgb(255, 205, 86)'
],
hoverOffset: 4
}]
}
}
chartOptions: { return {
maintainAspectRatio: false,
title: {
display: true,
text: 'Chart.js Doughnut Chart - Stacked'
},
tooltips: {
mode: 'index',
intersect: false
}
}
}
}
}
FluArea{
width: 500
height: 370
paddings: 10
Layout.topMargin: 20
FluChart{
anchors.fill: parent
chartType: "pie"
chartData: { return {
labels: [
'Red',
'Blue',
'Yellow'
],
datasets: [{
label: 'My First Dataset',
data: [300, 50, 100],
backgroundColor: [
'rgb(255, 99, 132)',
'rgb(54, 162, 235)',
'rgb(255, 205, 86)'
],
hoverOffset: 4
}]
}
}
chartOptions: { return {
maintainAspectRatio: false,
title: {
display: true,
text: 'Chart.js Pie Chart - Stacked'
},
tooltips: {
mode: 'index',
intersect: false
}
}
}
}
}
}

View File

@ -0,0 +1,58 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
import "qrc:///example/qml/component"
import "../component"
FluScrollablePage{
title:"PolarArea Chart"
FluArea{
width: 500
height: 370
paddings: 10
Layout.topMargin: 20
FluChart{
anchors.fill: parent
chartType: 'polarArea'
chartData: { return {
labels: [
'Red',
'Green',
'Yellow',
'Grey',
'Blue'
],
datasets: [{
label: 'My First Dataset',
data: [11, 16, 7, 3, 14],
backgroundColor: [
'rgb(255, 99, 132)',
'rgb(75, 192, 192)',
'rgb(255, 205, 86)',
'rgb(201, 203, 207)',
'rgb(54, 162, 235)'
]
}]
}
}
chartOptions: { return {
maintainAspectRatio: false,
title: {
display: true,
text: 'Chart.js PolarArea Chart - Stacked'
},
tooltips: {
mode: 'index',
intersect: false
}
}
}
}
}
}

View File

@ -0,0 +1,75 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
import "qrc:///example/qml/component"
import "../component"
FluScrollablePage{
title:"Radar Chart"
FluArea{
width: 500
height: 370
paddings: 10
Layout.topMargin: 20
FluChart{
anchors.fill: parent
chartType: 'radar'
chartData: { return {
labels: [
'Eating',
'Drinking',
'Sleeping',
'Designing',
'Coding',
'Cycling',
'Running'
],
datasets:
[{
label: 'My First Dataset',
data: [65, 59, 90, 81, 56, 55, 40],
fill: true,
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgb(255, 99, 132)',
pointBackgroundColor: 'rgb(255, 99, 132)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgb(255, 99, 132)'
}, {
label: 'My Second Dataset',
data: [28, 48, 40, 19, 96, 27, 100],
fill: true,
backgroundColor: 'rgba(54, 162, 235, 0.2)',
borderColor: 'rgb(54, 162, 235)',
pointBackgroundColor: 'rgb(54, 162, 235)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgb(54, 162, 235)'
}]
}
}
chartOptions: { return {
maintainAspectRatio: false,
title: {
display: true,
text: 'Chart.js Radar Chart - Stacked'
},
tooltips: {
mode: 'index',
intersect: false
},
elements: {
line: {
borderWidth: 3
}
}
}
}
}
}
}

View File

@ -0,0 +1,124 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
import "qrc:///example/qml/component"
import "../component"
FluScrollablePage{
title:"Scatter Chart"
function randomScalingFactor() {
return Math.random().toFixed(1);
}
FluArea{
height: 370
width: 500
paddings: 10
Layout.topMargin: 20
FluChart{
anchors.fill: parent
chartType: 'scatter'
chartData: {
return {
datasets: [{
label: 'My First dataset',
xAxisID: 'x-axis-1',
yAxisID: 'y-axis-1',
borderColor: '#ff5555',
backgroundColor: 'rgba(255,192,192,0.3)',
data: [{
x: randomScalingFactor(),
y: randomScalingFactor(),
}, {
x: randomScalingFactor(),
y: randomScalingFactor(),
}, {
x: randomScalingFactor(),
y: randomScalingFactor(),
}, {
x: randomScalingFactor(),
y: randomScalingFactor(),
}, {
x: randomScalingFactor(),
y: randomScalingFactor(),
}, {
x: randomScalingFactor(),
y: randomScalingFactor(),
}, {
x: randomScalingFactor(),
y: randomScalingFactor(),
}]
}, {
label: 'My Second dataset',
xAxisID: 'x-axis-1',
yAxisID: 'y-axis-2',
borderColor: '#5555ff',
backgroundColor: 'rgba(192,192,255,0.3)',
data: [{
x: randomScalingFactor(),
y: randomScalingFactor(),
}, {
x: randomScalingFactor(),
y: randomScalingFactor(),
}, {
x: randomScalingFactor(),
y: randomScalingFactor(),
}, {
x: randomScalingFactor(),
y: randomScalingFactor(),
}, {
x: randomScalingFactor(),
y: randomScalingFactor(),
}, {
x: randomScalingFactor(),
y: randomScalingFactor(),
}, {
x: randomScalingFactor(),
y: randomScalingFactor(),
}]
}]
}}
chartOptions: {return {
maintainAspectRatio: false,
responsive: true,
hoverMode: 'nearest',
intersect: true,
title: {
display: true,
text: 'Chart.js Scatter Chart - Multi Axis'
},
scales: {
xAxes: [{
position: 'bottom',
gridLines: {
zeroLineColor: 'rgba(0,0,0,1)'
}
}],
yAxes: [{
type: 'linear', // only linear but allow scale type registration. This allows extensions to exist solely for log scale for instance
display: true,
position: 'left',
id: 'y-axis-1',
}, {
type: 'linear', // only linear but allow scale type registration. This allows extensions to exist solely for log scale for instance
display: true,
position: 'right',
reverse: true,
id: 'y-axis-2',
// grid line settings
gridLines: {
drawOnChartArea: false, // only want the grid lines for one axis to show up
},
}],
}
}
}
}
}
}

View File

@ -368,6 +368,53 @@ FluObject{
} }
} }
FluPaneItemExpander{
title: Lang.chart
icon:FluentIcons.AreaChart
FluPaneItem{
title:Lang.bar_chart
menuDelegate: paneItemMenu
url:"qrc:/example/qml/chart/T_BarChart.qml"
onTap:{ navigationView.push(url) }
}
FluPaneItem{
title:Lang.line_chart
menuDelegate: paneItemMenu
url:"qrc:/example/qml/chart/T_LineChart.qml"
onTap:{ navigationView.push(url) }
}
FluPaneItem{
title:Lang.pie_chart
menuDelegate: paneItemMenu
url:"qrc:/example/qml/chart/T_PieChart.qml"
onTap:{ navigationView.push(url) }
}
FluPaneItem{
title:Lang.polar_area_chart
menuDelegate: paneItemMenu
url:"qrc:/example/qml/chart/T_PolarAreaChart.qml"
onTap:{ navigationView.push(url) }
}
FluPaneItem{
title:Lang.bubble_chart
menuDelegate: paneItemMenu
url:"qrc:/example/qml/chart/T_BubbleChart.qml"
onTap:{ navigationView.push(url) }
}
FluPaneItem{
title:Lang.scatter_chart
menuDelegate: paneItemMenu
url:"qrc:/example/qml/chart/T_ScatterChart.qml"
onTap:{ navigationView.push(url) }
}
FluPaneItem{
title:Lang.radar_chart
menuDelegate: paneItemMenu
url:"qrc:/example/qml/chart/T_RadarChart.qml"
onTap:{ navigationView.push(url) }
}
}
FluPaneItemSeparator{ FluPaneItemSeparator{
spacing:10 spacing:10
size:1 size:1
@ -406,12 +453,6 @@ FluObject{
url:"qrc:/example/qml/page/T_Captcha.qml" url:"qrc:/example/qml/page/T_Captcha.qml"
onTap:{ navigationView.push(url) } onTap:{ navigationView.push(url) }
} }
FluPaneItem{
title:"Chart"
menuDelegate: paneItemMenu
url:"qrc:/example/qml/page/T_Chart.qml"
onTap:{ navigationView.push(url) }
}
FluPaneItem{ FluPaneItem{
title:"Network" title:"Network"
menuDelegate: paneItemMenu menuDelegate: paneItemMenu

View File

@ -20,6 +20,14 @@ QtObject {
property string locale property string locale
property string navigation_view_display_mode property string navigation_view_display_mode
property string other property string other
property string chart
property string bar_chart
property string line_chart
property string pie_chart
property string polar_area_chart
property string bubble_chart
property string scatter_chart
property string radar_chart
function zh(){ function zh(){
home="首页" home="首页"
@ -38,6 +46,14 @@ QtObject {
locale="语言环境" locale="语言环境"
navigation_view_display_mode="导航视图显示模式" navigation_view_display_mode="导航视图显示模式"
other="其他" other="其他"
chart="表格"
bar_chart="条形图"
line_chart="折线图"
pie_chart="饼图"
polar_area_chart="极坐标区域图"
bubble_chart="气泡图"
scatter_chart="散点图"
radar_chart="雷达图"
} }
function en(){ function en(){
@ -57,6 +73,14 @@ QtObject {
locale="Locale" locale="Locale"
navigation_view_display_mode="NavigationView Display Mode" navigation_view_display_mode="NavigationView Display Mode"
other="Other" other="Other"
chart="Chart"
bar_chart="Bar Chart"
line_chart="Line Chart"
pie_chart="Pie Chart"
polar_area_chart="Polar Area Chart"
bubble_chart="Bubble Chart"
scatter_chart="Scatter Chart"
radar_chart="Radar Chart"
} }
property string __locale property string __locale

View File

@ -4,25 +4,27 @@ import "./../JS/Chart.js" as Chart
Canvas { Canvas {
id: control id: control
property var window: Window.window
property var jsChart: undefined
property string chartType property string chartType
property var chartData property var chartData
property var chartOptions property var chartOptions
property double chartAnimationProgress: 0.1 property double chartAnimationProgress: 0.1
property int animationEasingType: Easing.InOutExpo property int animationEasingType: Easing.InOutExpo
property double animationDuration: 0 property double animationDuration: 300
property var memorizedContext
property var memorizedData
property var memorizedOptions
property alias animationRunning: chartAnimator.running property alias animationRunning: chartAnimator.running
signal animationFinished() signal animationFinished()
function animateToNewData() function animateToNewData()
{ {
chartAnimationProgress = 0.1; chartAnimationProgress = 0.1;
jsChart.update(); d.jsChart.update();
chartAnimator.restart(); chartAnimator.restart();
} }
QtObject{
id:d
property var jsChart: undefined
property var memorizedContext
property var memorizedData
property var memorizedOptions
}
MouseArea { MouseArea {
id: event id: event
anchors.fill: control anchors.fill: control
@ -90,34 +92,25 @@ Canvas {
control.requestPaint(); control.requestPaint();
} }
onPaint: { onPaint: {
if(control.getContext('2d') !== null && memorizedContext !== control.getContext('2d') || memorizedData !== control.chartData || memorizedOptions !== control.chartOptions) { if(control.getContext('2d') !== null && d.memorizedContext !== control.getContext('2d') || d.memorizedData !== control.chartData || d.memorizedOptions !== control.chartOptions) {
var ctx = control.getContext('2d'); var ctx = control.getContext('2d');
d.jsChart = Chart.build(ctx, {type: control.chartType,data: control.chartData,options: control.chartOptions});
jsChart = Chart.build(ctx, { d.memorizedData = control.chartData ;
type: control.chartType, d.memorizedContext = control.getContext('2d');
data: control.chartData, d.memorizedOptions = control.chartOptions;
options: control.chartOptions d.jsChart.bindEvents(function(newHandler) {event.handler = newHandler;});
});
memorizedData = control.chartData ;
memorizedContext = control.getContext('2d');
memorizedOptions = control.chartOptions;
control.jsChart.bindEvents(function(newHandler) {event.handler = newHandler;});
chartAnimator.start(); chartAnimator.start();
} }
d.jsChart.draw(chartAnimationProgress);
jsChart.draw(chartAnimationProgress);
} }
onWidthChanged: { onWidthChanged: {
if(jsChart) { if(d.jsChart) {
jsChart.resize(); d.jsChart.resize();
} }
} }
onHeightChanged: { onHeightChanged: {
if(jsChart) { if(d.jsChart) {
jsChart.resize(); d.jsChart.resize();
} }
} }
} }

View File

@ -1,7 +1,7 @@
/*! /*!
* Chart.js v2.9.3 * Chart.js v2.9.4
* https://www.chartjs.org * https://www.chartjs.org
* (c) 2019 Chart.js Contributors * (c) 2020 Chart.js Contributors
* Released under the MIT License * Released under the MIT License
*/ */
@ -28,7 +28,7 @@ typeof define === 'function' && define.amd ? define(factory) :
function Chart (item, config) { 'use strict'; function Chart (item, config) { 'use strict';
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof _window !== 'undefined' ? _window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function commonjsRequire () { function commonjsRequire () {
throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs'); throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
@ -1618,6 +1618,10 @@ function hwbString(hwb, alpha) {
+ (alpha !== undefined && alpha !== 1 ? ", " + alpha : "") + ")"; + (alpha !== undefined && alpha !== 1 ? ", " + alpha : "") + ")";
} }
function keyword(rgb) {
return reverseNames[rgb.slice(0, 3)];
}
// helpers // helpers
function scale(num, min, max) { function scale(num, min, max) {
return Math.min(Math.max(min, num), max); return Math.min(Math.max(min, num), max);
@ -1628,15 +1632,16 @@ function hexDouble(num) {
return (str.length < 2) ? "0" + str : str; return (str.length < 2) ? "0" + str : str;
} }
//create a list of reverse color names //create a list of reverse color names
var reverseNames = {}; var reverseNames = {};
for (var name in colorName$1) { for (var name in colorName$1) {
reverseNames[colorName$1[name]] = name; reverseNames[colorName$1[name]] = name;
} }
function keyword(rgb) { /* MIT license */
return reverseNames[rgb.slice(0, 3)];
}
var Color = function (obj) { var Color = function (obj) {
if (obj instanceof Color) { if (obj instanceof Color) {
@ -2114,12 +2119,17 @@ Color.prototype.setChannel = function (space, index, val) {
return this; return this;
}; };
if (typeof window !== 'undefined') { if (typeof _window !== 'undefined') {
// window.Color = Color; console.debug(_window)
_window.Color = Color;
} }
var chartjsColor = Color; var chartjsColor = Color;
function isValidKey(key) {
return ['__proto__', 'prototype', 'constructor'].indexOf(key) === -1;
}
/** /**
* @namespace Chart.helpers * @namespace Chart.helpers
*/ */
@ -2295,7 +2305,7 @@ var helpers = {
} }
if (helpers.isObject(source)) { if (helpers.isObject(source)) {
var target = {}; var target = Object.create(source);
var keys = Object.keys(source); var keys = Object.keys(source);
var klen = keys.length; var klen = keys.length;
var k = 0; var k = 0;
@ -2316,6 +2326,12 @@ var helpers = {
* @private * @private
*/ */
_merger: function(key, target, source, options) { _merger: function(key, target, source, options) {
if (!isValidKey(key)) {
// We want to ensure we do not copy prototypes over
// as this can pollute global namespaces
return;
}
var tval = target[key]; var tval = target[key];
var sval = source[key]; var sval = source[key];
@ -2331,6 +2347,12 @@ var helpers = {
* @private * @private
*/ */
_mergerIf: function(key, target, source) { _mergerIf: function(key, target, source) {
if (!isValidKey(key)) {
// We want to ensure we do not copy prototypes over
// as this can pollute global namespaces
return;
}
var tval = target[key]; var tval = target[key];
var sval = source[key]; var sval = source[key];
@ -3832,7 +3854,7 @@ helpers$1.extend(DatasetController.prototype, {
*/ */
_configure: function() { _configure: function() {
var me = this; var me = this;
me._config = helpers$1.merge({}, [ me._config = helpers$1.merge(Object.create(null), [
me.chart.options.datasets[me._type], me.chart.options.datasets[me._type],
me.getDataset(), me.getDataset(),
], { ], {
@ -6142,9 +6164,9 @@ var controller_line = core_datasetController.extend({
}; };
model.backgroundColor = valueOrDefault$6(options.hoverBackgroundColor, getHoverColor(options.backgroundColor)); model.backgroundColor = valueOrDefault$6(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));
model.borderColor = "rgba(255,0,0,1.)";//valueOrDefault$6(options.hoverBorderColor, getHoverColor(options.borderColor)); model.borderColor = valueOrDefault$6(options.hoverBorderColor, getHoverColor(options.borderColor));
model.borderWidth = 1;//valueOrDefault$6(options.hoverBorderWidth, options.borderWidth); model.borderWidth = valueOrDefault$6(options.hoverBorderWidth, options.borderWidth);
model.radius = 2;//valueOrDefault$6(options.hoverRadius, options.radius); model.radius = valueOrDefault$6(options.hoverRadius, options.radius);
}, },
}); });
@ -7105,7 +7127,8 @@ function updateDims(chartArea, params, layout) {
chartArea.h = newHeight; chartArea.h = newHeight;
// return true if chart area changed in layout's direction // return true if chart area changed in layout's direction
return layout.horizontal ? newWidth !== chartArea.w : newHeight !== chartArea.h; var sizes = layout.horizontal ? [newWidth, chartArea.w] : [newHeight, chartArea.h];
return sizes[0] !== sizes[1] && (!isNaN(sizes[0]) || !isNaN(sizes[1]));
} }
} }
@ -7526,7 +7549,7 @@ var supportsEventListenerOptions = (function() {
supports = true; supports = true;
} }
}); });
window.addEventListener('e', null, options); _window.addEventListener('e', null, options);
} catch (e) { } catch (e) {
// continue regardless of error // continue regardless of error
} }
@ -7571,7 +7594,7 @@ function throttled(fn, thisArg) {
if (!ticking) { if (!ticking) {
ticking = true; ticking = true;
helpers$1.requestAnimFrame.call(window, function() { helpers$1.requestAnimFrame.call(_window, function() {
ticking = false; ticking = false;
fn.apply(thisArg, args); fn.apply(thisArg, args);
}); });
@ -7738,7 +7761,7 @@ var platform_dom$2 = {
* Currently used by platform.js to select the proper implementation. * Currently used by platform.js to select the proper implementation.
* @private * @private
*/ */
_enabled: typeof window !== 'undefined' && typeof document !== 'undefined', _enabled: typeof _window !== 'undefined' && typeof document !== 'undefined',
/** /**
* Initializes resources that depend on platform options. * Initializes resources that depend on platform options.
@ -8117,7 +8140,7 @@ var core_scaleService = {
}, },
getScaleDefaults: function(type) { getScaleDefaults: function(type) {
// Return the scale defaults merged with the global settings so that we always use the latest ones // Return the scale defaults merged with the global settings so that we always use the latest ones
return this.defaults.hasOwnProperty(type) ? helpers$1.merge({}, [core_defaults.scale, this.defaults[type]]) : {}; return this.defaults.hasOwnProperty(type) ? helpers$1.merge(Object.create(null), [core_defaults.scale, this.defaults[type]]) : {};
}, },
updateScaleDefaults: function(type, additions) { updateScaleDefaults: function(type, additions) {
var me = this; var me = this;
@ -9192,7 +9215,7 @@ core_defaults._set('global', {
* returns a deep copy of the result, thus doesn't alter inputs. * returns a deep copy of the result, thus doesn't alter inputs.
*/ */
function mergeScaleConfig(/* config objects ... */) { function mergeScaleConfig(/* config objects ... */) {
return helpers$1.merge({}, [].slice.call(arguments), { return helpers$1.merge(Object.create(null), [].slice.call(arguments), {
merger: function(key, target, source, options) { merger: function(key, target, source, options) {
if (key === 'xAxes' || key === 'yAxes') { if (key === 'xAxes' || key === 'yAxes') {
var slen = source[key].length; var slen = source[key].length;
@ -9232,9 +9255,9 @@ function mergeScaleConfig(/* config objects ... */) {
* a deep copy of the result, thus doesn't alter inputs. * a deep copy of the result, thus doesn't alter inputs.
*/ */
function mergeConfig(/* config objects ... */) { function mergeConfig(/* config objects ... */) {
return helpers$1.merge({}, [].slice.call(arguments), { return helpers$1.merge(Object.create(null), [].slice.call(arguments), {
merger: function(key, target, source, options) { merger: function(key, target, source, options) {
var tval = target[key] || {}; var tval = target[key] || Object.create(null);
var sval = source[key]; var sval = source[key];
if (key === 'scales') { if (key === 'scales') {
@ -9251,7 +9274,7 @@ function mergeConfig(/* config objects ... */) {
} }
function initConfig(config) { function initConfig(config) {
config = config || {}; config = config || Object.create(null);
// Do NOT use mergeConfig for the data object because this method merges arrays // Do NOT use mergeConfig for the data object because this method merges arrays
// and so would change references to labels and datasets, preventing data updates. // and so would change references to labels and datasets, preventing data updates.
@ -9778,7 +9801,6 @@ helpers$1.extend(Chart.prototype, /** @lends Chart */ {
} }
var animationOptions = me.options.animation; var animationOptions = me.options.animation;
var duration = valueOrDefault$9(config.duration, animationOptions && animationOptions.duration); var duration = valueOrDefault$9(config.duration, animationOptions && animationOptions.duration);
var lazy = config.lazy; var lazy = config.lazy;
@ -9915,7 +9937,6 @@ helpers$1.extend(Chart.prototype, /** @lends Chart */ {
} }
metasets = me._getSortedVisibleDatasetMetas(); metasets = me._getSortedVisibleDatasetMetas();
for (i = metasets.length - 1; i >= 0; --i) { for (i = metasets.length - 1; i >= 0; --i) {
me.drawDataset(metasets[i], easingValue); me.drawDataset(metasets[i], easingValue);
} }
@ -10643,18 +10664,18 @@ var core_helpers = function() {
}; };
// Request animation polyfill - https://www.paulirish.com/2011/requestanimationframe-for-smart-animating/ // Request animation polyfill - https://www.paulirish.com/2011/requestanimationframe-for-smart-animating/
helpers$1.requestAnimFrame = (function() { helpers$1.requestAnimFrame = (function() {
if (typeof window === 'undefined') { if (typeof _window === 'undefined') {
return function(callback) { return function(callback) {
callback(); callback();
}; };
} }
return window.requestAnimationFrame || return _window.requestAnimationFrame ||
window.webkitRequestAnimationFrame || _window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame || _window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame || _window.oRequestAnimationFrame ||
window.msRequestAnimationFrame || _window.msRequestAnimationFrame ||
function(callback) { function(callback) {
return window.setTimeout(callback, 1000 / 60); return _window.setTimeout(callback, 1000 / 60);
}; };
}()); }());
// -- DOM methods // -- DOM methods
@ -10785,7 +10806,7 @@ var core_helpers = function() {
document.defaultView.getComputedStyle(el, null).getPropertyValue(property); document.defaultView.getComputedStyle(el, null).getPropertyValue(property);
}; };
helpers$1.retinaScale = function(chart, forceRatio) { helpers$1.retinaScale = function(chart, forceRatio) {
var pixelRatio = chart.currentDevicePixelRatio = forceRatio || (typeof window !== 'undefined' && window.devicePixelRatio) || 1; var pixelRatio = chart.currentDevicePixelRatio = forceRatio || (typeof _window !== 'undefined' && _window.devicePixelRatio) || 1;
if (pixelRatio === 1) { if (pixelRatio === 1) {
return; return;
} }
@ -11215,6 +11236,8 @@ function computeLabelSizes(ctx, tickFonts, ticks, caches) {
var widths = []; var widths = [];
var heights = []; var heights = [];
var offsets = []; var offsets = [];
var widestLabelSize = 0;
var highestLabelSize = 0;
var i, j, jlen, label, tickFont, fontString, cache, lineHeight, width, height, nestedLabel, widest, highest; var i, j, jlen, label, tickFont, fontString, cache, lineHeight, width, height, nestedLabel, widest, highest;
for (i = 0; i < length; ++i) { for (i = 0; i < length; ++i) {
@ -11242,11 +11265,13 @@ function computeLabelSizes(ctx, tickFonts, ticks, caches) {
widths.push(width); widths.push(width);
heights.push(height); heights.push(height);
offsets.push(lineHeight / 2); offsets.push(lineHeight / 2);
widestLabelSize = Math.max(width, widestLabelSize);
highestLabelSize = Math.max(height, highestLabelSize);
} }
garbageCollect(caches, length); garbageCollect(caches, length);
widest = widths.indexOf(Math.max.apply(null, widths)); widest = widths.indexOf(widestLabelSize);
highest = heights.indexOf(Math.max.apply(null, heights)); highest = heights.indexOf(highestLabelSize);
function valueAt(idx) { function valueAt(idx) {
return { return {
@ -20668,8 +20693,9 @@ core_controller.platform.initialize();
var src = core_controller; var src = core_controller;
if (window !== 'undefined') { if (typeof _window !== 'undefined') {
// window.Chart = core_controller; console.debug(_window)
_window.Chart = core_controller;
} }
// DEPRECATIONS // DEPRECATIONS