Add Chart, add Timestamps
This commit is contained in:
parent
7040bccb71
commit
6c56d01266
|
@ -4,6 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
|
@ -34,5 +35,9 @@ func CreateData(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (data *EnvironmentData) toBSON() bson.M {
|
func (data *EnvironmentData) toBSON() bson.M {
|
||||||
return bson.M{"Temperature": data.Temp, "Humidity": data.Humidity}
|
|
||||||
|
return bson.M{"Temperature": data.Temp,
|
||||||
|
"Humidity": data.Humidity,
|
||||||
|
"Time": time.Now().UTC(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
namespace ManagementPage.Models
|
||||||
|
{
|
||||||
|
public class DataSet
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public DateTime x { get; set; }
|
||||||
|
public double y { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,6 +14,9 @@ namespace ManagementPage.Models
|
||||||
[JsonPropertyName("t")]
|
[JsonPropertyName("t")]
|
||||||
public double Temperature { get; set; }
|
public double Temperature { get; set; }
|
||||||
|
|
||||||
|
[BsonDateTimeOptions(Kind = DateTimeKind.Utc)]
|
||||||
|
public DateTime Time { get; set; }
|
||||||
|
|
||||||
[BsonConstructor]
|
[BsonConstructor]
|
||||||
public EnvironmentData(double humidity, double temperature)
|
public EnvironmentData(double humidity, double temperature)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,10 +3,23 @@
|
||||||
@{
|
@{
|
||||||
}
|
}
|
||||||
|
|
||||||
@foreach(var d in Model.data)
|
|
||||||
{
|
|
||||||
<div>
|
<div>
|
||||||
Temp: @d.Temperature
|
<h2>Current Conditions</h2>
|
||||||
Humidity: @d.Humidity
|
<div>
|
||||||
|
Temp: @Model.data.Last().Temperature.ToString("N1")
|
||||||
</div>
|
</div>
|
||||||
}
|
<div>
|
||||||
|
Humidity: @Model.data.Last().Humidity.ToString("N1")
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<canvas id="tempChart" width="400" height="400"></canvas>
|
||||||
|
|
||||||
|
<script src="~/lib/chart.js/dist/chart.js"></script>
|
||||||
|
<script src="~/js/temperature_chart.js" asp-append-version="true"></script>
|
||||||
|
<script>
|
||||||
|
var ctx = document.getElementById('tempChart');
|
||||||
|
var temp = @Json.Serialize(Model.temperature);
|
||||||
|
var humidity = @Json.Serialize(Model.humidity);
|
||||||
|
var chart = CreateChart(ctx, temp, humidity);
|
||||||
|
</script>
|
|
@ -12,17 +12,31 @@ namespace ManagementPage.Pages
|
||||||
public class UserHomeModel : PageModel
|
public class UserHomeModel : PageModel
|
||||||
{
|
{
|
||||||
public List<EnvironmentData> data;
|
public List<EnvironmentData> data;
|
||||||
|
public List<DataSet> humidity;
|
||||||
|
public List<DataSet> temperature;
|
||||||
|
|
||||||
private readonly MongoDbClient _dbClient;
|
private readonly MongoDbClient _dbClient;
|
||||||
public UserHomeModel(MongoDbClient dbClient)
|
public UserHomeModel(MongoDbClient dbClient)
|
||||||
{
|
{
|
||||||
data = new List<EnvironmentData>();
|
data = new List<EnvironmentData>();
|
||||||
|
humidity = new List<DataSet>();
|
||||||
|
temperature = new List<DataSet>();
|
||||||
_dbClient = dbClient;
|
_dbClient = dbClient;
|
||||||
}
|
}
|
||||||
public async Task OnGetAsync()
|
public async Task OnGetAsync()
|
||||||
{
|
{
|
||||||
using var cursor = await _dbClient.collection.FindAsync(new BsonDocument());
|
FindOptions<EnvironmentData> options = new FindOptions<EnvironmentData>
|
||||||
|
{
|
||||||
|
Limit = 100,
|
||||||
|
NoCursorTimeout = false
|
||||||
|
};
|
||||||
|
using var cursor = await _dbClient.collection.FindAsync(new BsonDocument(), options);
|
||||||
data.AddRange(await cursor.ToListAsync());
|
data.AddRange(await cursor.ToListAsync());
|
||||||
|
foreach (var item in data)
|
||||||
|
{
|
||||||
|
humidity.Add(new DataSet() { x = item.Time, y = item.Humidity });
|
||||||
|
temperature.Add(new DataSet() { x = item.Time, y = item.Temperature });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"version": "1.0",
|
||||||
|
"defaultProvider": "jsdelivr",
|
||||||
|
"libraries": [
|
||||||
|
{
|
||||||
|
"library": "chart.js@3.5.1",
|
||||||
|
"destination": "wwwroot/lib/chart.js/"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
function CreateChart(ctx, temp, humidity) {
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
datasets: [
|
||||||
|
{
|
||||||
|
label: "Temperature",
|
||||||
|
fill: false,
|
||||||
|
borderColor: 'rgb(255, 55, 55)',
|
||||||
|
data: temp,
|
||||||
|
tension: 0.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Humidity",
|
||||||
|
//data: [23, 24, 25],
|
||||||
|
fill: false,
|
||||||
|
borderColor: 'rgb(55, 55, 255)',
|
||||||
|
data: humidity,
|
||||||
|
tension: 0.1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
type: 'line',
|
||||||
|
data: data,
|
||||||
|
options: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
return tempChart = new Chart(ctx, config);
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014-2021 Chart.js Contributors
|
||||||
|
|
||||||
|
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.
|
|
@ -0,0 +1,36 @@
|
||||||
|
<p align="center">
|
||||||
|
<img src="https://www.chartjs.org/media/logo-title.svg"><br/>
|
||||||
|
Simple yet flexible JavaScript charting for designers & developers
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://www.chartjs.org/docs/latest/getting-started/installation.html"><img src="https://img.shields.io/github/release/chartjs/Chart.js.svg?style=flat-square&maxAge=600" alt="Downloads"></a>
|
||||||
|
<a href="https://github.com/chartjs/Chart.js/actions?query=workflow%3ACI+branch%3Amaster"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/chartjs/Chart.js/CI"></a>
|
||||||
|
<a href="https://coveralls.io/github/chartjs/Chart.js?branch=master"><img src="https://img.shields.io/coveralls/chartjs/Chart.js.svg?style=flat-square&maxAge=600" alt="Coverage"></a>
|
||||||
|
<a href="https://github.com/chartjs/awesome"><img src="https://awesome.re/badge-flat2.svg" alt="Awesome"></a>
|
||||||
|
<a href="https://chartjs-slack.herokuapp.com/"><img src="https://img.shields.io/badge/slack-chartjs-blue.svg?style=flat-square&maxAge=3600" alt="Slack"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
All the links point to the new version 3 of the lib.
|
||||||
|
|
||||||
|
* [Introduction](https://www.chartjs.org/docs/latest/)
|
||||||
|
* [Getting Started](https://www.chartjs.org/docs/latest/getting-started/index)
|
||||||
|
* [General](https://www.chartjs.org/docs/latest/general/data-structures)
|
||||||
|
* [Configuration](https://www.chartjs.org/docs/latest/configuration/index)
|
||||||
|
* [Charts](https://www.chartjs.org/docs/latest/charts/line)
|
||||||
|
* [Axes](https://www.chartjs.org/docs/latest/axes/index)
|
||||||
|
* [Developers](https://www.chartjs.org/docs/latest/developers/index)
|
||||||
|
* [Popular Extensions](https://github.com/chartjs/awesome)
|
||||||
|
* [Samples](https://www.chartjs.org/samples/)
|
||||||
|
|
||||||
|
In case you are looking for the docs of version 2, you will have to specify the specific version in the url like this: [https://www.chartjs.org/docs/2.9.4/](https://www.chartjs.org/docs/2.9.4/)
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Instructions on building and testing Chart.js can be found in [the documentation](https://www.chartjs.org/docs/master/developers/contributing.html#building-and-testing). Before submitting an issue or a pull request, please take a moment to look over the [contributing guidelines](https://www.chartjs.org/docs/master/developers/contributing) first. For support, please post questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/chartjs) with the `chartjs` tag.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Chart.js is available under the [MIT license](https://opensource.org/licenses/MIT).
|
|
@ -0,0 +1,4 @@
|
||||||
|
import { Chart } from '../types/index.esm';
|
||||||
|
|
||||||
|
export * from '../types/index.esm';
|
||||||
|
export default Chart;
|
|
@ -0,0 +1,5 @@
|
||||||
|
import {Chart, registerables} from '../dist/chart.esm';
|
||||||
|
|
||||||
|
Chart.register(...registerables);
|
||||||
|
|
||||||
|
export default Chart;
|
|
@ -0,0 +1,8 @@
|
||||||
|
/**
|
||||||
|
* Minified by jsDelivr using Terser v5.7.1.
|
||||||
|
* Original file: /npm/chart.js@3.5.1/auto/auto.esm.js
|
||||||
|
*
|
||||||
|
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
||||||
|
*/
|
||||||
|
import{Chart,registerables}from"../dist/chart.esm";Chart.register(...registerables);export default Chart;
|
||||||
|
//# sourceMappingURL=/sm/e88fbc10be8b1816dbb7291f6225b0168eff78d2ca2657e132aa26ac49fe3e0f.map
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('../dist/chart');
|
|
@ -0,0 +1,5 @@
|
||||||
|
/**
|
||||||
|
* Skipped minification because the original files appears to be already minified.
|
||||||
|
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
||||||
|
*/
|
||||||
|
module.exports = require('../dist/chart');
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"name": "chart.js-auto",
|
||||||
|
"private": true,
|
||||||
|
"description": "auto registering package",
|
||||||
|
"main": "auto.js",
|
||||||
|
"module": "auto.esm.js",
|
||||||
|
"types": "auto.esm.d.ts"
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
2476
ManagementPage/ManagementPage/wwwroot/lib/chart.js/dist/chunks/helpers.segment.js
vendored
Normal file
2476
ManagementPage/ManagementPage/wwwroot/lib/chart.js/dist/chunks/helpers.segment.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
14
ManagementPage/ManagementPage/wwwroot/lib/chart.js/dist/chunks/helpers.segment.min.js
vendored
Normal file
14
ManagementPage/ManagementPage/wwwroot/lib/chart.js/dist/chunks/helpers.segment.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,7 @@
|
||||||
|
/*!
|
||||||
|
* Chart.js v3.5.1
|
||||||
|
* https://www.chartjs.org
|
||||||
|
* (c) 2021 Chart.js Contributors
|
||||||
|
* Released under the MIT License
|
||||||
|
*/
|
||||||
|
export { H as HALF_PI, aU as INFINITY, P as PI, aT as PITAU, aW as QUARTER_PI, aV as RAD_PER_DEG, T as TAU, aX as TWO_THIRDS_PI, N as _addGrace, S as _alignPixel, Z as _alignStartEnd, o as _angleBetween, aY as _angleDiff, _ as _arrayUnique, a4 as _attachContext, an as _bezierCurveTo, ak as _bezierInterpolation, as as _boundSegment, ai as _boundSegments, a1 as _capitalize, ah as _computeSegments, a5 as _createResolver, aE as _decimalPlaces, aM as _deprecated, a6 as _descriptors, ad as _elementsEqual, K as _factorize, aG as _filterBetween, D as _getParentNode, R as _int16Range, I as _isDomSupported, y as _isPointInArea, q as _limitValue, aF as _longestText, aH as _lookup, w as _lookupByKey, Q as _measureText, aK as _merger, aL as _mergerIf, at as _normalizeAngle, al as _pointInLine, af as _readValueToProps, z as _rlookupByKey, aA as _setMinAndMaxByKey, aj as _steppedInterpolation, am as _steppedLineTo, aw as _textX, Y as _toLeftRightCenter, ag as _updateBezierControlPoints, ap as addRoundedRectPath, aD as almostEquals, aC as almostWhole, M as callback, ab as clearCanvas, U as clipArea, aJ as clone, c as color, a9 as debounce, h as defined, az as distanceBetweenPoints, ao as drawPoint, B as each, e as easingEffects, L as finiteOrDefault, aR as fontString, n as formatNumber, ae as getAngleFromPoint, aI as getHoverColor, C as getMaximumSize, x as getRelativePosition, au as getRtlAdapter, aQ as getStyle, b as isArray, g as isFinite, a3 as isFunction, j as isNullOrUndef, p as isNumber, i as isObject, l as listenArrayEvents, J as log10, a0 as merge, a7 as mergeIf, aB as niceNum, ay as noop, av as overrideTextDirection, E as readUsedSize, V as renderText, r as requestAnimFrame, a as resolve, f as resolveObjectKey, ax as restoreTextDirection, aa as retinaScale, ac as setsEqual, s as sign, aO as splineCurve, aP as splineCurveMonotone, G as supportsEventListenerOptions, F as throttled, O as toDegrees, m as toDimension, X as toFont, aN as toFontString, aS as toLineHeight, A as toPadding, k as toPercentage, t as toRadians, aq as toTRBL, ar as toTRBLCorners, a8 as uid, W as unclipArea, u as unlistenArrayEvents, v as valueOrDefault } from './chunks/helpers.segment.js';
|
|
@ -0,0 +1,11 @@
|
||||||
|
/**
|
||||||
|
* Skipped minification because the original files appears to be already minified.
|
||||||
|
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
||||||
|
*/
|
||||||
|
/*!
|
||||||
|
* Chart.js v3.5.1
|
||||||
|
* https://www.chartjs.org
|
||||||
|
* (c) 2021 Chart.js Contributors
|
||||||
|
* Released under the MIT License
|
||||||
|
*/
|
||||||
|
export { H as HALF_PI, aU as INFINITY, P as PI, aT as PITAU, aW as QUARTER_PI, aV as RAD_PER_DEG, T as TAU, aX as TWO_THIRDS_PI, N as _addGrace, S as _alignPixel, Z as _alignStartEnd, o as _angleBetween, aY as _angleDiff, _ as _arrayUnique, a4 as _attachContext, an as _bezierCurveTo, ak as _bezierInterpolation, as as _boundSegment, ai as _boundSegments, a1 as _capitalize, ah as _computeSegments, a5 as _createResolver, aE as _decimalPlaces, aM as _deprecated, a6 as _descriptors, ad as _elementsEqual, K as _factorize, aG as _filterBetween, D as _getParentNode, R as _int16Range, I as _isDomSupported, y as _isPointInArea, q as _limitValue, aF as _longestText, aH as _lookup, w as _lookupByKey, Q as _measureText, aK as _merger, aL as _mergerIf, at as _normalizeAngle, al as _pointInLine, af as _readValueToProps, z as _rlookupByKey, aA as _setMinAndMaxByKey, aj as _steppedInterpolation, am as _steppedLineTo, aw as _textX, Y as _toLeftRightCenter, ag as _updateBezierControlPoints, ap as addRoundedRectPath, aD as almostEquals, aC as almostWhole, M as callback, ab as clearCanvas, U as clipArea, aJ as clone, c as color, a9 as debounce, h as defined, az as distanceBetweenPoints, ao as drawPoint, B as each, e as easingEffects, L as finiteOrDefault, aR as fontString, n as formatNumber, ae as getAngleFromPoint, aI as getHoverColor, C as getMaximumSize, x as getRelativePosition, au as getRtlAdapter, aQ as getStyle, b as isArray, g as isFinite, a3 as isFunction, j as isNullOrUndef, p as isNumber, i as isObject, l as listenArrayEvents, J as log10, a0 as merge, a7 as mergeIf, aB as niceNum, ay as noop, av as overrideTextDirection, E as readUsedSize, V as renderText, r as requestAnimFrame, a as resolve, f as resolveObjectKey, ax as restoreTextDirection, aa as retinaScale, ac as setsEqual, s as sign, aO as splineCurve, aP as splineCurveMonotone, G as supportsEventListenerOptions, F as throttled, O as toDegrees, m as toDimension, X as toFont, aN as toFontString, aS as toLineHeight, A as toPadding, k as toPercentage, t as toRadians, aq as toTRBL, ar as toTRBLCorners, a8 as uid, W as unclipArea, u as unlistenArrayEvents, v as valueOrDefault } from './chunks/helpers.segment.js';
|
|
@ -0,0 +1 @@
|
||||||
|
export * from '../types/helpers';
|
|
@ -0,0 +1 @@
|
||||||
|
export * from '../dist/helpers.esm';
|
5
ManagementPage/ManagementPage/wwwroot/lib/chart.js/helpers/helpers.esm.min.js
vendored
Normal file
5
ManagementPage/ManagementPage/wwwroot/lib/chart.js/helpers/helpers.esm.min.js
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
/**
|
||||||
|
* Skipped minification because the original files appears to be already minified.
|
||||||
|
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
||||||
|
*/
|
||||||
|
export * from '../dist/helpers.esm';
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('..').helpers;
|
|
@ -0,0 +1,5 @@
|
||||||
|
/**
|
||||||
|
* Skipped minification because the original files appears to be already minified.
|
||||||
|
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
||||||
|
*/
|
||||||
|
module.exports = require('..').helpers;
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"name": "chart.js-helpers",
|
||||||
|
"private": true,
|
||||||
|
"description": "helper package",
|
||||||
|
"main": "helpers.js",
|
||||||
|
"module": "helpers.esm.js",
|
||||||
|
"types": "helpers.esm.d.ts"
|
||||||
|
}
|
|
@ -0,0 +1,108 @@
|
||||||
|
{
|
||||||
|
"name": "chart.js",
|
||||||
|
"homepage": "https://www.chartjs.org",
|
||||||
|
"description": "Simple HTML5 charts using the canvas element.",
|
||||||
|
"version": "3.5.1",
|
||||||
|
"license": "MIT",
|
||||||
|
"jsdelivr": "dist/chart.min.js",
|
||||||
|
"unpkg": "dist/chart.min.js",
|
||||||
|
"main": "dist/chart.js",
|
||||||
|
"module": "dist/chart.esm.js",
|
||||||
|
"types": "types/index.esm.d.ts",
|
||||||
|
"keywords": [
|
||||||
|
"canvas",
|
||||||
|
"charts",
|
||||||
|
"data",
|
||||||
|
"graphs",
|
||||||
|
"html5",
|
||||||
|
"responsive"
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/chartjs/Chart.js.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/chartjs/Chart.js/issues"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"auto/**/*.js",
|
||||||
|
"auto/**/*.d.ts",
|
||||||
|
"dist/*.js",
|
||||||
|
"dist/chunks/*.js",
|
||||||
|
"types/*.d.ts",
|
||||||
|
"types/helpers/*.d.ts",
|
||||||
|
"helpers/**/*.js",
|
||||||
|
"helpers/**/*.d.ts"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"autobuild": "rollup -c -w",
|
||||||
|
"build": "rollup -c",
|
||||||
|
"dev": "karma start --auto-watch --no-single-run --browsers chrome --grep",
|
||||||
|
"dev:ff": "karma start --auto-watch --no-single-run --browsers firefox --grep",
|
||||||
|
"docs": "npm run build && vuepress build docs --no-cache",
|
||||||
|
"docs:dev": "npm run build && vuepress dev docs --no-cache",
|
||||||
|
"lint-js": "eslint \"src/**/*.js\" \"test/**/*.js\" \"docs/**/*.js\"",
|
||||||
|
"lint-md": "eslint \"**/*.md\"",
|
||||||
|
"lint-tsc": "tsc",
|
||||||
|
"lint-types": "eslint \"types/**/*.ts\" && tsc -p types/tests/",
|
||||||
|
"lint": "concurrently \"npm:lint-*\"",
|
||||||
|
"test": "npm run lint && cross-env NODE_ENV=test karma start --auto-watch --single-run --coverage --grep"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@kurkle/color": "^0.1.9",
|
||||||
|
"@rollup/plugin-commonjs": "^19.0.0",
|
||||||
|
"@rollup/plugin-inject": "^4.0.2",
|
||||||
|
"@rollup/plugin-json": "^4.1.0",
|
||||||
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
||||||
|
"@simonbrunel/vuepress-plugin-versions": "^0.2.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^4.21.0",
|
||||||
|
"@typescript-eslint/parser": "^4.21.0",
|
||||||
|
"@vuepress/plugin-google-analytics": "1.8.2",
|
||||||
|
"@vuepress/plugin-html-redirect": "^0.1.2",
|
||||||
|
"chartjs-adapter-luxon": "^1.0.0",
|
||||||
|
"chartjs-adapter-moment": "^1.0.0",
|
||||||
|
"chartjs-test-utils": "^0.3.0",
|
||||||
|
"concurrently": "^6.0.1",
|
||||||
|
"coveralls": "^3.1.0",
|
||||||
|
"cross-env": "^7.0.3",
|
||||||
|
"eslint": "^7.23.0",
|
||||||
|
"eslint-config-chartjs": "^0.3.0",
|
||||||
|
"eslint-plugin-es": "^4.1.0",
|
||||||
|
"eslint-plugin-html": "^6.1.2",
|
||||||
|
"eslint-plugin-markdown": "^2.1.0",
|
||||||
|
"glob": "^7.1.6",
|
||||||
|
"jasmine": "^3.7.0",
|
||||||
|
"jasmine-core": "^3.7.1",
|
||||||
|
"karma": "^6.3.2",
|
||||||
|
"karma-chrome-launcher": "^3.1.0",
|
||||||
|
"karma-coverage": "^2.0.3",
|
||||||
|
"karma-edge-launcher": "^0.4.2",
|
||||||
|
"karma-firefox-launcher": "^2.1.0",
|
||||||
|
"karma-jasmine": "^4.0.1",
|
||||||
|
"karma-jasmine-html-reporter": "^1.5.4",
|
||||||
|
"karma-rollup-preprocessor": "^7.0.7",
|
||||||
|
"karma-safari-private-launcher": "^1.0.0",
|
||||||
|
"karma-spec-reporter": "0.0.32",
|
||||||
|
"luxon": "^1.26.0",
|
||||||
|
"markdown-it-include": "^2.0.0",
|
||||||
|
"moment": "^2.29.1",
|
||||||
|
"pixelmatch": "^5.2.1",
|
||||||
|
"rollup": "^2.44.0",
|
||||||
|
"rollup-plugin-analyzer": "^4.0.0",
|
||||||
|
"rollup-plugin-cleanup": "^3.2.1",
|
||||||
|
"rollup-plugin-istanbul": "^3.0.0",
|
||||||
|
"rollup-plugin-terser": "^7.0.2",
|
||||||
|
"typedoc": "^0.21.2",
|
||||||
|
"typedoc-plugin-markdown": "^3.6.1",
|
||||||
|
"typescript": "^4.3.5",
|
||||||
|
"vue-tabs-component": "^1.5.0",
|
||||||
|
"vuepress": "^1.8.2",
|
||||||
|
"vuepress-plugin-code-copy": "^1.0.6",
|
||||||
|
"vuepress-plugin-flexsearch": "^0.2.0",
|
||||||
|
"vuepress-plugin-redirect": "^1.2.5",
|
||||||
|
"vuepress-plugin-tabs": "^0.3.0",
|
||||||
|
"vuepress-plugin-typedoc": "^0.8.1",
|
||||||
|
"vuepress-theme-chartjs": "^0.2.0",
|
||||||
|
"yargs": "^17.0.1"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
export type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
||||||
|
|
||||||
|
export interface DateAdapter {
|
||||||
|
// Override one or multiple of the methods to adjust to the logic of the current date library.
|
||||||
|
override(members: Partial<DateAdapter>): void;
|
||||||
|
readonly options: unknown;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a map of time formats for the supported formatting units defined
|
||||||
|
* in Unit as well as 'datetime' representing a detailed date/time string.
|
||||||
|
* @returns {{string: string}}
|
||||||
|
*/
|
||||||
|
formats(): { [key: string]: string };
|
||||||
|
/**
|
||||||
|
* Parses the given `value` and return the associated timestamp.
|
||||||
|
* @param {unknown} value - the value to parse (usually comes from the data)
|
||||||
|
* @param {string} [format] - the expected data format
|
||||||
|
*/
|
||||||
|
parse(value: unknown, format?: TimeUnit): number | null;
|
||||||
|
/**
|
||||||
|
* Returns the formatted date in the specified `format` for a given `timestamp`.
|
||||||
|
* @param {number} timestamp - the timestamp to format
|
||||||
|
* @param {string} format - the date/time token
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
format(timestamp: number, format: TimeUnit): string;
|
||||||
|
/**
|
||||||
|
* Adds the specified `amount` of `unit` to the given `timestamp`.
|
||||||
|
* @param {number} timestamp - the input timestamp
|
||||||
|
* @param {number} amount - the amount to add
|
||||||
|
* @param {Unit} unit - the unit as string
|
||||||
|
* @return {number}
|
||||||
|
*/
|
||||||
|
add(timestamp: number, amount: number, unit: TimeUnit): number;
|
||||||
|
/**
|
||||||
|
* Returns the number of `unit` between the given timestamps.
|
||||||
|
* @param {number} a - the input timestamp (reference)
|
||||||
|
* @param {number} b - the timestamp to subtract
|
||||||
|
* @param {Unit} unit - the unit as string
|
||||||
|
* @return {number}
|
||||||
|
*/
|
||||||
|
diff(a: number, b: number, unit: TimeUnit): number;
|
||||||
|
/**
|
||||||
|
* Returns start of `unit` for the given `timestamp`.
|
||||||
|
* @param {number} timestamp - the input timestamp
|
||||||
|
* @param {Unit|'isoWeek'} unit - the unit as string
|
||||||
|
* @param {number} [weekday] - the ISO day of the week with 1 being Monday
|
||||||
|
* and 7 being Sunday (only needed if param *unit* is `isoWeek`).
|
||||||
|
* @return {number}
|
||||||
|
*/
|
||||||
|
startOf(timestamp: number, unit: TimeUnit | 'isoWeek', weekday?: number): number;
|
||||||
|
/**
|
||||||
|
* Returns end of `unit` for the given `timestamp`.
|
||||||
|
* @param {number} timestamp - the input timestamp
|
||||||
|
* @param {Unit|'isoWeek'} unit - the unit as string
|
||||||
|
* @return {number}
|
||||||
|
*/
|
||||||
|
endOf(timestamp: number, unit: TimeUnit | 'isoWeek'): number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const _adapters: {
|
||||||
|
_date: DateAdapter;
|
||||||
|
};
|
|
@ -0,0 +1,32 @@
|
||||||
|
import { Chart } from './index.esm';
|
||||||
|
import { AnyObject } from './basic';
|
||||||
|
|
||||||
|
export class Animation {
|
||||||
|
constructor(cfg: AnyObject, target: AnyObject, prop: string, to?: unknown);
|
||||||
|
active(): boolean;
|
||||||
|
update(cfg: AnyObject, to: unknown, date: number): void;
|
||||||
|
cancel(): void;
|
||||||
|
tick(date: number): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AnimationEvent {
|
||||||
|
chart: Chart;
|
||||||
|
numSteps: number;
|
||||||
|
currentState: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Animator {
|
||||||
|
listen(chart: Chart, event: 'complete' | 'progress', cb: (event: AnimationEvent) => void): void;
|
||||||
|
add(chart: Chart, items: readonly Animation[]): void;
|
||||||
|
has(chart: Chart): boolean;
|
||||||
|
start(chart: Chart): void;
|
||||||
|
running(chart: Chart): boolean;
|
||||||
|
stop(chart: Chart): void;
|
||||||
|
remove(chart: Chart): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Animations {
|
||||||
|
constructor(chart: Chart, animations: AnyObject);
|
||||||
|
configure(animations: AnyObject): void;
|
||||||
|
update(target: AnyObject, values: AnyObject): undefined | boolean;
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
export type AnyObject = Record<string, unknown>;
|
||||||
|
export type EmptyObject = Record<string, never>;
|
|
@ -0,0 +1 @@
|
||||||
|
export type Color = string | CanvasGradient | CanvasPattern;
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { AnyObject } from './basic';
|
||||||
|
import { Point } from './geometric';
|
||||||
|
|
||||||
|
export interface Element<T = AnyObject, O = AnyObject> {
|
||||||
|
readonly x: number;
|
||||||
|
readonly y: number;
|
||||||
|
readonly active: boolean;
|
||||||
|
readonly options: O;
|
||||||
|
|
||||||
|
tooltipPosition(useFinalPosition?: boolean): Point;
|
||||||
|
hasValue(): boolean;
|
||||||
|
getProps<P extends (keyof T)[]>(props: P, final?: boolean): Pick<T, P[number]>;
|
||||||
|
}
|
||||||
|
export const Element: {
|
||||||
|
prototype: Element;
|
||||||
|
new <T = AnyObject, O = AnyObject>(): Element<T, O>;
|
||||||
|
};
|
|
@ -0,0 +1,13 @@
|
||||||
|
export interface ChartArea {
|
||||||
|
top: number;
|
||||||
|
left: number;
|
||||||
|
right: number;
|
||||||
|
bottom: number;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Point {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
}
|
99
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.canvas.d.ts
vendored
Normal file
99
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.canvas.d.ts
vendored
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
import { PointStyle } from '../index.esm';
|
||||||
|
import { Color } from '../color';
|
||||||
|
import { ChartArea } from '../geometric';
|
||||||
|
import { CanvasFontSpec } from './helpers.options';
|
||||||
|
|
||||||
|
export function clearCanvas(canvas: HTMLCanvasElement, ctx?: CanvasRenderingContext2D): void;
|
||||||
|
|
||||||
|
export function clipArea(ctx: CanvasRenderingContext2D, area: ChartArea): void;
|
||||||
|
|
||||||
|
export function unclipArea(ctx: CanvasRenderingContext2D): void;
|
||||||
|
|
||||||
|
export interface DrawPointOptions {
|
||||||
|
pointStyle: PointStyle;
|
||||||
|
rotation?: number;
|
||||||
|
radius: number;
|
||||||
|
borderWidth: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function drawPoint(ctx: CanvasRenderingContext2D, options: DrawPointOptions, x: number, y: number): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the given font object into a CSS font string.
|
||||||
|
* @param font a font object
|
||||||
|
* @return The CSS font string. See https://developer.mozilla.org/en-US/docs/Web/CSS/font
|
||||||
|
*/
|
||||||
|
export function toFontString(font: { size: number; family: string; style?: string; weight?: string }): string | null;
|
||||||
|
|
||||||
|
export interface RenderTextOpts {
|
||||||
|
/**
|
||||||
|
* The fill color of the text. If unset, the existing
|
||||||
|
* fillStyle property of the canvas is unchanged.
|
||||||
|
*/
|
||||||
|
color?: Color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The width of the strikethrough / underline
|
||||||
|
* @default 2
|
||||||
|
*/
|
||||||
|
decorationWidth?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The max width of the text in pixels
|
||||||
|
*/
|
||||||
|
maxWidth?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A rotation to be applied to the canvas
|
||||||
|
* This is applied after the translation is applied
|
||||||
|
*/
|
||||||
|
rotation?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply a strikethrough effect to the text
|
||||||
|
*/
|
||||||
|
strikethrough?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color of the text stroke. If unset, the existing
|
||||||
|
* strokeStyle property of the context is unchanged
|
||||||
|
*/
|
||||||
|
strokeColor?: Color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The text stroke width. If unset, the existing
|
||||||
|
* lineWidth property of the context is unchanged
|
||||||
|
*/
|
||||||
|
strokeWidth?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The text alignment to use. If unset, the existing
|
||||||
|
* textAlign property of the context is unchanged
|
||||||
|
*/
|
||||||
|
textAlign: CanvasTextAlign;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The text baseline to use. If unset, the existing
|
||||||
|
* textBaseline property of the context is unchanged
|
||||||
|
*/
|
||||||
|
textBaseline: CanvasTextBaseline;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If specified, a translation to apply to the context
|
||||||
|
*/
|
||||||
|
translation?: [number, number];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Underline the text
|
||||||
|
*/
|
||||||
|
underline?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function renderText(
|
||||||
|
ctx: CanvasRenderingContext2D,
|
||||||
|
text: string | string[],
|
||||||
|
x: number,
|
||||||
|
y: number,
|
||||||
|
font: CanvasFontSpec,
|
||||||
|
opts?: RenderTextOpts
|
||||||
|
): void;
|
20
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.collection.d.ts
vendored
Normal file
20
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.collection.d.ts
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
export interface ArrayListener<T> {
|
||||||
|
_onDataPush?(...item: T[]): void;
|
||||||
|
_onDataPop?(): void;
|
||||||
|
_onDataShift?(): void;
|
||||||
|
_onDataSplice?(index: number, deleteCount: number, ...items: T[]): void;
|
||||||
|
_onDataUnshift?(...item: T[]): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hooks the array methods that add or remove values ('push', pop', 'shift', 'splice',
|
||||||
|
* 'unshift') and notify the listener AFTER the array has been altered. Listeners are
|
||||||
|
* called on the '_onData*' callbacks (e.g. _onDataPush, etc.) with same arguments.
|
||||||
|
*/
|
||||||
|
export function listenArrayEvents<T>(array: T[], listener: ArrayListener<T>): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the given array event listener and cleanup extra attached properties (such as
|
||||||
|
* the _chartjs stub and overridden methods) if array doesn't have any more listeners.
|
||||||
|
*/
|
||||||
|
export function unlistenArrayEvents<T>(array: T[], listener: ArrayListener<T>): void;
|
33
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.color.d.ts
vendored
Normal file
33
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.color.d.ts
vendored
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
export function color(value: CanvasGradient): CanvasGradient;
|
||||||
|
export function color(value: CanvasPattern): CanvasPattern;
|
||||||
|
export function color(
|
||||||
|
value:
|
||||||
|
| string
|
||||||
|
| { r: number; g: number; b: number; a: number }
|
||||||
|
| [number, number, number]
|
||||||
|
| [number, number, number, number]
|
||||||
|
): ColorModel;
|
||||||
|
|
||||||
|
export interface ColorModel {
|
||||||
|
rgbString(): string;
|
||||||
|
hexString(): string;
|
||||||
|
hslString(): string;
|
||||||
|
rgb: { r: number; g: number; b: number; a: number };
|
||||||
|
valid: boolean;
|
||||||
|
mix(color: ColorModel, weight: number): this;
|
||||||
|
clone(): ColorModel;
|
||||||
|
alpha(a: number): ColorModel;
|
||||||
|
clearer(ration: number): ColorModel;
|
||||||
|
greyscale(): ColorModel;
|
||||||
|
opaquer(ratio: number): ColorModel;
|
||||||
|
negate(): ColorModel;
|
||||||
|
lighten(ratio: number): ColorModel;
|
||||||
|
darken(ratio: number): ColorModel;
|
||||||
|
saturate(ratio: number): ColorModel;
|
||||||
|
desaturate(ratio: number): ColorModel;
|
||||||
|
rotate(deg: number): this;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getHoverColor(value: CanvasGradient): CanvasGradient;
|
||||||
|
export function getHoverColor(value: CanvasPattern): CanvasPattern;
|
||||||
|
export function getHoverColor(value: string): string;
|
140
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.core.d.ts
vendored
Normal file
140
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.core.d.ts
vendored
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
import { AnyObject } from '../basic';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An empty function that can be used, for example, for optional callback.
|
||||||
|
*/
|
||||||
|
export function noop(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a unique id, sequentially generated from a global variable.
|
||||||
|
* @returns {number}
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
export function uid(): number;
|
||||||
|
/**
|
||||||
|
* Returns true if `value` is neither null nor undefined, else returns false.
|
||||||
|
* @param {*} value - The value to test.
|
||||||
|
* @returns {boolean}
|
||||||
|
* @since 2.7.0
|
||||||
|
*/
|
||||||
|
export function isNullOrUndef(value: unknown): value is null | undefined;
|
||||||
|
/**
|
||||||
|
* Returns true if `value` is an array (including typed arrays), else returns false.
|
||||||
|
* @param {*} value - The value to test.
|
||||||
|
* @returns {boolean}
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
export function isArray<T = unknown>(value: unknown): value is ArrayLike<T>;
|
||||||
|
/**
|
||||||
|
* Returns true if `value` is an object (excluding null), else returns false.
|
||||||
|
* @param {*} value - The value to test.
|
||||||
|
* @returns {boolean}
|
||||||
|
* @since 2.7.0
|
||||||
|
*/
|
||||||
|
export function isObject(value: unknown): value is AnyObject;
|
||||||
|
/**
|
||||||
|
* Returns true if `value` is a finite number, else returns false
|
||||||
|
* @param {*} value - The value to test.
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
export function isFinite(value: unknown): value is number;
|
||||||
|
/**
|
||||||
|
* Returns `value` if defined, else returns `defaultValue`.
|
||||||
|
* @param {*} value - The value to return if defined.
|
||||||
|
* @param {*} defaultValue - The value to return if `value` is undefined.
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
export function valueOrDefault<T>(value: T | undefined, defaultValue: T): T;
|
||||||
|
/**
|
||||||
|
* Calls `fn` with the given `args` in the scope defined by `thisArg` and returns the
|
||||||
|
* value returned by `fn`. If `fn` is not a function, this method returns undefined.
|
||||||
|
* @param fn - The function to call.
|
||||||
|
* @param args - The arguments with which `fn` should be called.
|
||||||
|
* @param [thisArg] - The value of `this` provided for the call to `fn`.
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
export function callback<T extends (this: TA, ...args: unknown[]) => R, TA, R>(
|
||||||
|
fn: T | undefined,
|
||||||
|
args: unknown[],
|
||||||
|
thisArg?: TA
|
||||||
|
): R | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Note(SB) for performance sake, this method should only be used when loopable type
|
||||||
|
* is unknown or in none intensive code (not called often and small loopable). Else
|
||||||
|
* it's preferable to use a regular for() loop and save extra function calls.
|
||||||
|
* @param loopable - The object or array to be iterated.
|
||||||
|
* @param fn - The function to call for each item.
|
||||||
|
* @param [thisArg] - The value of `this` provided for the call to `fn`.
|
||||||
|
* @param [reverse] - If true, iterates backward on the loopable.
|
||||||
|
*/
|
||||||
|
export function each<T, TA>(
|
||||||
|
loopable: T[],
|
||||||
|
fn: (this: TA, v: T, i: number) => void,
|
||||||
|
thisArg?: TA,
|
||||||
|
reverse?: boolean
|
||||||
|
): void;
|
||||||
|
/**
|
||||||
|
* Note(SB) for performance sake, this method should only be used when loopable type
|
||||||
|
* is unknown or in none intensive code (not called often and small loopable). Else
|
||||||
|
* it's preferable to use a regular for() loop and save extra function calls.
|
||||||
|
* @param loopable - The object or array to be iterated.
|
||||||
|
* @param fn - The function to call for each item.
|
||||||
|
* @param [thisArg] - The value of `this` provided for the call to `fn`.
|
||||||
|
* @param [reverse] - If true, iterates backward on the loopable.
|
||||||
|
*/
|
||||||
|
export function each<T, TA>(
|
||||||
|
loopable: { [key: string]: T },
|
||||||
|
fn: (this: TA, v: T, k: string) => void,
|
||||||
|
thisArg?: TA,
|
||||||
|
reverse?: boolean
|
||||||
|
): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a deep copy of `source` without keeping references on objects and arrays.
|
||||||
|
* @param source - The value to clone.
|
||||||
|
*/
|
||||||
|
export function clone<T>(source: T): T;
|
||||||
|
|
||||||
|
export interface MergeOptions {
|
||||||
|
merger?: (key: string, target: AnyObject, source: AnyObject, options: AnyObject) => AnyObject;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Recursively deep copies `source` properties into `target` with the given `options`.
|
||||||
|
* IMPORTANT: `target` is not cloned and will be updated with `source` properties.
|
||||||
|
* @param target - The target object in which all sources are merged into.
|
||||||
|
* @param source - Object(s) to merge into `target`.
|
||||||
|
* @param {object} [options] - Merging options:
|
||||||
|
* @param {function} [options.merger] - The merge method (key, target, source, options)
|
||||||
|
* @returns {object} The `target` object.
|
||||||
|
*/
|
||||||
|
export function merge<T>(target: T, source: [], options?: MergeOptions): T;
|
||||||
|
export function merge<T, S1>(target: T, source: S1, options?: MergeOptions): T & S1;
|
||||||
|
export function merge<T, S1>(target: T, source: [S1], options?: MergeOptions): T & S1;
|
||||||
|
export function merge<T, S1, S2>(target: T, source: [S1, S2], options?: MergeOptions): T & S1 & S2;
|
||||||
|
export function merge<T, S1, S2, S3>(target: T, source: [S1, S2, S3], options?: MergeOptions): T & S1 & S2 & S3;
|
||||||
|
export function merge<T, S1, S2, S3, S4>(
|
||||||
|
target: T,
|
||||||
|
source: [S1, S2, S3, S4],
|
||||||
|
options?: MergeOptions
|
||||||
|
): T & S1 & S2 & S3 & S4;
|
||||||
|
export function merge<T>(target: T, source: AnyObject[], options?: MergeOptions): AnyObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively deep copies `source` properties into `target` *only* if not defined in target.
|
||||||
|
* IMPORTANT: `target` is not cloned and will be updated with `source` properties.
|
||||||
|
* @param target - The target object in which all sources are merged into.
|
||||||
|
* @param source - Object(s) to merge into `target`.
|
||||||
|
* @returns The `target` object.
|
||||||
|
*/
|
||||||
|
export function mergeIf<T>(target: T, source: []): T;
|
||||||
|
export function mergeIf<T, S1>(target: T, source: S1): T & S1;
|
||||||
|
export function mergeIf<T, S1>(target: T, source: [S1]): T & S1;
|
||||||
|
export function mergeIf<T, S1, S2>(target: T, source: [S1, S2]): T & S1 & S2;
|
||||||
|
export function mergeIf<T, S1, S2, S3>(target: T, source: [S1, S2, S3]): T & S1 & S2 & S3;
|
||||||
|
export function mergeIf<T, S1, S2, S3, S4>(target: T, source: [S1, S2, S3, S4]): T & S1 & S2 & S3 & S4;
|
||||||
|
export function mergeIf<T>(target: T, source: AnyObject[]): AnyObject;
|
||||||
|
|
||||||
|
export function resolveObjectKey(obj: AnyObject, key: string): AnyObject;
|
||||||
|
|
||||||
|
export function setsEqual(a: Set<unknown>, b: Set<unknown>): boolean;
|
34
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.curve.d.ts
vendored
Normal file
34
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.curve.d.ts
vendored
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
export interface SplinePoint {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Props to Rob Spencer at scaled innovation for his post on splining between points
|
||||||
|
* http://scaledinnovation.com/analytics/splines/aboutSplines.html
|
||||||
|
*/
|
||||||
|
export function splineCurve(
|
||||||
|
firstPoint: SplinePoint & { skip?: boolean },
|
||||||
|
middlePoint: SplinePoint,
|
||||||
|
afterPoint: SplinePoint,
|
||||||
|
t: number
|
||||||
|
): {
|
||||||
|
previous: SplinePoint;
|
||||||
|
next: SplinePoint;
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface MonotoneSplinePoint extends SplinePoint {
|
||||||
|
skip: boolean;
|
||||||
|
cp1x?: number;
|
||||||
|
cp1y?: number;
|
||||||
|
cp2x?: number;
|
||||||
|
cp2y?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function calculates Bézier control points in a similar way than |splineCurve|,
|
||||||
|
* but preserves monotonicity of the provided data and ensures no local extremums are added
|
||||||
|
* between the dataset discrete points due to the interpolation.
|
||||||
|
* @see https://en.wikipedia.org/wiki/Monotone_cubic_interpolation
|
||||||
|
*/
|
||||||
|
export function splineCurveMonotone(points: readonly MonotoneSplinePoint[], indexAxis?: 'x' | 'y'): void;
|
17
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.dom.d.ts
vendored
Normal file
17
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.dom.d.ts
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
export function getMaximumSize(node: HTMLElement, width?: number, height?: number, aspectRatio?: number): { width: number, height: number };
|
||||||
|
export function getRelativePosition(
|
||||||
|
evt: MouseEvent,
|
||||||
|
chart: { readonly canvas: HTMLCanvasElement }
|
||||||
|
): { x: number; y: number };
|
||||||
|
export function getStyle(el: HTMLElement, property: string): string;
|
||||||
|
export function retinaScale(
|
||||||
|
chart: {
|
||||||
|
currentDevicePixelRatio: number;
|
||||||
|
readonly canvas: HTMLCanvasElement;
|
||||||
|
readonly width: number;
|
||||||
|
readonly height: number;
|
||||||
|
readonly ctx: CanvasRenderingContext2D;
|
||||||
|
},
|
||||||
|
forceRatio: number,
|
||||||
|
forceStyle?: boolean
|
||||||
|
): void;
|
5
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.easing.d.ts
vendored
Normal file
5
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.easing.d.ts
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import { EasingFunction } from '../index.esm';
|
||||||
|
|
||||||
|
export type EasingFunctionSignature = (t: number) => number;
|
||||||
|
|
||||||
|
export const easingEffects: Record<EasingFunction, EasingFunctionSignature>;
|
23
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.extras.d.ts
vendored
Normal file
23
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.extras.d.ts
vendored
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
export function fontString(pixelSize: number, fontStyle: string, fontFamily: string): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request animation polyfill
|
||||||
|
*/
|
||||||
|
export function requestAnimFrame(cb: () => void): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throttles calling `fn` once per animation frame
|
||||||
|
* Latest argments are used on the actual call
|
||||||
|
* @param {function} fn
|
||||||
|
* @param {*} thisArg
|
||||||
|
* @param {function} [updateFn]
|
||||||
|
*/
|
||||||
|
export function throttled(fn: (...args: unknown[]) => void, thisArg: unknown, updateFn?: (...args: unknown[]) => unknown[]): (...args: unknown[]) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Debounces calling `fn` for `delay` ms
|
||||||
|
* @param {function} fn - Function to call. No arguments are passed.
|
||||||
|
* @param {number} delay - Delay in ms. 0 = immediate invocation.
|
||||||
|
* @returns {function}
|
||||||
|
*/
|
||||||
|
export function debounce(fn: () => void, delay: number): () => number;
|
1
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.interpolation.d.ts
vendored
Normal file
1
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.interpolation.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
7
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.intl.d.ts
vendored
Normal file
7
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.intl.d.ts
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/**
|
||||||
|
* Format a number using a localized number formatter.
|
||||||
|
* @param num The number to format
|
||||||
|
* @param locale The locale to pass to the Intl.NumberFormat constructor
|
||||||
|
* @param options Number format options
|
||||||
|
*/
|
||||||
|
export function formatNumber(num: number, locale: string, options: Intl.NumberFormatOptions): string;
|
16
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.math.d.ts
vendored
Normal file
16
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.math.d.ts
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
export function log10(x: number): number;
|
||||||
|
export function isNumber(v: unknown): boolean;
|
||||||
|
export function almostEquals(x: number, y: number, epsilon: number): boolean;
|
||||||
|
export function almostWhole(x: number, epsilon: number): number;
|
||||||
|
export function sign(x: number): number;
|
||||||
|
export function toRadians(degrees: number): number;
|
||||||
|
export function toDegrees(radians: number): number;
|
||||||
|
/**
|
||||||
|
* Gets the angle from vertical upright to the point about a centre.
|
||||||
|
*/
|
||||||
|
export function getAngleFromPoint(
|
||||||
|
centrePoint: { x: number; y: number },
|
||||||
|
anglePoint: { x: number; y: number }
|
||||||
|
): { angle: number; distance: number };
|
||||||
|
|
||||||
|
export function distanceBetweenPoints(pt1: { x: number; y: number }, pt2: { x: number; y: number }): number;
|
50
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.options.d.ts
vendored
Normal file
50
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.options.d.ts
vendored
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
import { FontSpec } from '../index.esm';
|
||||||
|
|
||||||
|
export interface CanvasFontSpec extends FontSpec {
|
||||||
|
string: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Parses font options and returns the font object.
|
||||||
|
* @param {object} options - A object that contains font options to be parsed.
|
||||||
|
* @return {object} The font object.
|
||||||
|
*/
|
||||||
|
export function toFont(options: Partial<FontSpec>): CanvasFontSpec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the given line height `value` in pixels for a specific font `size`.
|
||||||
|
* @param {number|string} value - The lineHeight to parse (eg. 1.6, '14px', '75%', '1.6em').
|
||||||
|
* @param {number} size - The font size (in pixels) used to resolve relative `value`.
|
||||||
|
* @returns {number} The effective line height in pixels (size * 1.2 if value is invalid).
|
||||||
|
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
|
||||||
|
* @since 2.7.0
|
||||||
|
*/
|
||||||
|
export function toLineHeight(value: string, size: number): number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the given value into a padding object with pre-computed width/height.
|
||||||
|
* @param {number|object} value - If a number, set the value to all TRBL component;
|
||||||
|
* else, if an object, use defined properties and sets undefined ones to 0.
|
||||||
|
* @returns {object} The padding values (top, right, bottom, left, width, height)
|
||||||
|
* @since 2.7.0
|
||||||
|
*/
|
||||||
|
export function toPadding(
|
||||||
|
value?: number | { top?: number; left?: number; right?: number; bottom?: number; x?:number, y?: number }
|
||||||
|
): { top: number; left: number; right: number; bottom: number; width: number; height: number };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Evaluates the given `inputs` sequentially and returns the first defined value.
|
||||||
|
* @param inputs - An array of values, falling back to the last value.
|
||||||
|
* @param [context] - If defined and the current value is a function, the value
|
||||||
|
* is called with `context` as first argument and the result becomes the new input.
|
||||||
|
* @param [index] - If defined and the current value is an array, the value
|
||||||
|
* at `index` become the new input.
|
||||||
|
* @param [info] - object to return information about resolution in
|
||||||
|
* @param [info.cacheable] - Will be set to `false` if option is not cacheable.
|
||||||
|
* @since 2.7.0
|
||||||
|
*/
|
||||||
|
export function resolve<T, C>(
|
||||||
|
inputs: undefined | T | ((c: C) => T) | readonly T[],
|
||||||
|
context?: C,
|
||||||
|
index?: number,
|
||||||
|
info?: { cacheable?: boolean }
|
||||||
|
): T | undefined;
|
12
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.rtl.d.ts
vendored
Normal file
12
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.rtl.d.ts
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
export interface RTLAdapter {
|
||||||
|
x(x: number): number;
|
||||||
|
setWidth(w: number): void;
|
||||||
|
textAlign(align: 'center' | 'left' | 'right'): 'center' | 'left' | 'right';
|
||||||
|
xPlus(x: number, value: number): number;
|
||||||
|
leftForLtr(x: number, itemWidth: number): number;
|
||||||
|
}
|
||||||
|
export function getRtlAdapter(rtl: boolean, rectX: number, width: number): RTLAdapter;
|
||||||
|
|
||||||
|
export function overrideTextDirection(ctx: CanvasRenderingContext2D, direction: 'ltr' | 'rtl'): void;
|
||||||
|
|
||||||
|
export function restoreTextDirection(ctx: CanvasRenderingContext2D, original?: [string, string]): void;
|
1
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.segment.d.ts
vendored
Normal file
1
ManagementPage/ManagementPage/wwwroot/lib/chart.js/types/helpers/helpers.segment.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
|
@ -0,0 +1,15 @@
|
||||||
|
export * from './helpers.canvas';
|
||||||
|
export * from './helpers.collection';
|
||||||
|
export * from './helpers.color';
|
||||||
|
export * from './helpers.core';
|
||||||
|
export * from './helpers.curve';
|
||||||
|
export * from './helpers.dom';
|
||||||
|
export * from './helpers.easing';
|
||||||
|
export * from './helpers.extras';
|
||||||
|
export * from './helpers.interpolation';
|
||||||
|
export * from './helpers.intl';
|
||||||
|
export * from './helpers.math';
|
||||||
|
export * from './helpers.options';
|
||||||
|
export * from './helpers.canvas';
|
||||||
|
export * from './helpers.rtl';
|
||||||
|
export * from './helpers.segment';
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,65 @@
|
||||||
|
import { ChartArea } from './geometric';
|
||||||
|
|
||||||
|
export type LayoutPosition = 'left' | 'top' | 'right' | 'bottom' | 'center' | 'chartArea' | {[scaleId: string]: number};
|
||||||
|
|
||||||
|
export interface LayoutItem {
|
||||||
|
/**
|
||||||
|
* The position of the item in the chart layout. Possible values are
|
||||||
|
*/
|
||||||
|
position: LayoutPosition;
|
||||||
|
/**
|
||||||
|
* The weight used to sort the item. Higher weights are further away from the chart area
|
||||||
|
*/
|
||||||
|
weight: number;
|
||||||
|
/**
|
||||||
|
* if true, and the item is horizontal, then push vertical boxes down
|
||||||
|
*/
|
||||||
|
fullSize: boolean;
|
||||||
|
/**
|
||||||
|
* Width of item. Must be valid after update()
|
||||||
|
*/
|
||||||
|
width: number;
|
||||||
|
/**
|
||||||
|
* Height of item. Must be valid after update()
|
||||||
|
*/
|
||||||
|
height: number;
|
||||||
|
/**
|
||||||
|
* Left edge of the item. Set by layout system and cannot be used in update
|
||||||
|
*/
|
||||||
|
left: number;
|
||||||
|
/**
|
||||||
|
* Top edge of the item. Set by layout system and cannot be used in update
|
||||||
|
*/
|
||||||
|
top: number;
|
||||||
|
/**
|
||||||
|
* Right edge of the item. Set by layout system and cannot be used in update
|
||||||
|
*/
|
||||||
|
right: number;
|
||||||
|
/**
|
||||||
|
* Bottom edge of the item. Set by layout system and cannot be used in update
|
||||||
|
*/
|
||||||
|
bottom: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called before the layout process starts
|
||||||
|
*/
|
||||||
|
beforeLayout?(): void;
|
||||||
|
/**
|
||||||
|
* Draws the element
|
||||||
|
*/
|
||||||
|
draw(chartArea: ChartArea): void;
|
||||||
|
/**
|
||||||
|
* Returns an object with padding on the edges
|
||||||
|
*/
|
||||||
|
getPadding?(): ChartArea;
|
||||||
|
/**
|
||||||
|
* returns true if the layout item is horizontal (ie. top or bottom)
|
||||||
|
*/
|
||||||
|
isHorizontal(): boolean;
|
||||||
|
/**
|
||||||
|
* Takes two parameters: width and height.
|
||||||
|
* @param width
|
||||||
|
* @param height
|
||||||
|
*/
|
||||||
|
update(width: number, height: number, margins?: ChartArea): void;
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
/* eslint-disable @typescript-eslint/ban-types */
|
||||||
|
|
||||||
|
// DeepPartial implementation taken from the utility-types NPM package, which is
|
||||||
|
// Copyright (c) 2016 Piotr Witek <piotrek.witek@gmail.com> (http://piotrwitek.github.io)
|
||||||
|
// and used under the terms of the MIT license
|
||||||
|
export type DeepPartial<T> = T extends Function
|
||||||
|
? T
|
||||||
|
: T extends Array<infer U>
|
||||||
|
? _DeepPartialArray<U>
|
||||||
|
: T extends object
|
||||||
|
? _DeepPartialObject<T>
|
||||||
|
: T | undefined;
|
||||||
|
|
||||||
|
type _DeepPartialArray<T> = Array<DeepPartial<T>>
|
||||||
|
type _DeepPartialObject<T> = { [P in keyof T]?: DeepPartial<T[P]> };
|
||||||
|
|
||||||
|
export type DistributiveArray<T> = [T] extends [unknown] ? Array<T> : never
|
||||||
|
|
||||||
|
// https://stackoverflow.com/a/50375286
|
||||||
|
export type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
||||||
|
|
Loading…
Reference in New Issue