Skip to content

Commit

Permalink
Platforms update
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhealey committed Aug 15, 2021
1 parent cd11c49 commit c3cc699
Show file tree
Hide file tree
Showing 54 changed files with 41,596 additions and 28,552 deletions.
4 changes: 2 additions & 2 deletions platforms/android/android.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
"/manifest": [
{
"xml": "<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\" />",
"count": 12629,
"count": 12719,
"after": "uses-permission"
},
{
"xml": "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />",
"count": 12629,
"count": 12719,
"after": "uses-permission"
},
{
Expand Down
2 changes: 1 addition & 1 deletion platforms/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="30100" android:versionName="3.1.0" package="com.waist.line" xmlns:android="http://schemas.android.com/apk/res/android">
<manifest android:hardwareAccelerated="true" android:versionCode="30101" android:versionName="3.1.1" package="com.waist.line" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ app.FoodsMealsRecipes = {
if (x !== undefined) {
let dataPortion = parseFloat(x.portion);
let itemPortion = parseFloat(items[i].portion);
let itemQuantity = parseFloat(items[i].quantity) || 1;
let itemQuantity = parseFloat(items[i].quantity) || 0;
let multiplier = (itemPortion / dataPortion) * itemQuantity;

for (let n in x.nutrition) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ app.Settings = {
if (darkMode === true) {
body.className = colourTheme + " theme-dark";
panel.style["background-color"] = "black";
Chart.defaults.defaultFontColor = 'white';
Chart.defaults.global.defaultFontColor = 'white';
} else {
body.className = colourTheme;
panel.style["background-color"] = "white";
Chart.defaults.defaultFontColor = 'black';
Chart.defaults.global.defaultFontColor = 'black';
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,29 @@ app.Stats = {
app.Stats.chart.data.datasets[0].label = data.dataset.label;
app.Stats.chart.data.datasets[0].data = data.dataset.values;
}
app.Stats.updateAnnotations(data.average, data.goal);

app.Stats.chart.annotation.elements = [];
app.Stats.chart.options.annotation.annotations = [{
id: "average",
type: 'line',
mode: 'horizontal',
scaleID: 'y-axis-0',
value: data.average,
borderColor: 'red',
borderWidth: 2
},
{
id: "goal",
type: 'line',
mode: 'horizontal',
scaleID: 'y-axis-0',
value: data.goal,
borderColor: 'green',
borderWidth: 3
}
];

app.Stats.chart.update();
},

renderStatLog: async function(field) {
Expand Down Expand Up @@ -196,7 +218,7 @@ app.Stats = {

let after = document.createElement("div");
after.className = "item-after";
after.innerHTML = Math.round(average) + " (" + unit + ")";
after.innerHTML = Math.round(average) + " " + unit;
inner.appendChild(after);

return li;
Expand Down Expand Up @@ -324,8 +346,6 @@ app.Stats = {
},

renderChart: function(data) {
Chart.register("AnnotationPlugin");

app.Stats.chart = new Chart(app.Stats.el.chart, {
type: app.Stats.chartType,
data: {
Expand All @@ -339,62 +359,31 @@ app.Stats = {
}]
},
options: {
plugins: {
annotation: {
annotations: []
animation: {
duration: 1000 * !app.Settings.get("theme", "animations"),
},
annotation: {
annotations: []
},
legend: {
labels: {
font: {
size: 16,
weight: "bold"
}
},
legend: {
labels: {
font: {
size: 16,
weight: "bold"
}
},
onClick: (e) => {}
}
onClick: (e) => {}
},
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
},
animation: !app.Settings.get("theme", "animations")
}
}
});
},

updateAnnotations: function(average, goal) {
let annotations = [];

if (average != undefined) {
annotations.push({
id: "average",
type: 'line',
yScaleID: "yAxes",
yMin: average,
yMax: average,
borderColor: 'rgb(255, 99, 132)',
borderWidth: 1
});
}

if (goal != undefined) {
annotations.push({
id: "goal",
type: 'line',
yScaleID: "yAxes",
yMin: goal,
yMax: goal,
borderColor: 'rgb(99, 99, 255)',
borderWidth: 3
});
}

app.Stats.chart.options.plugins.annotation.annotations = annotations;
app.Stats.chart.update();
}
};

document.addEventListener("page:init", function(event) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Contributing to Chart.js
========================

Contributions to Chart.js are welcome and encouraged, but please have a look through the guidelines in this document before raising an issue, or writing code for the project.


Using issues
------------

The [issue tracker](https://github.com/chartjs/Chart.js/issues) is the preferred channel for reporting bugs, requesting new features and submitting pull requests.

If you're suggesting a new chart type, please take a look at [writing new chart types](https://github.com/chartjs/Chart.js/blob/master/docs/07-Advanced.md#writing-new-chart-types) in the documentation or consider [creating a plugin](https://github.com/chartjs/Chart.js/blob/master/docs/07-Advanced.md#creating-plugins).

To keep the library lightweight for everyone, it's unlikely we'll add many more chart types to the core of Chart.js, but issues are a good medium to design and spec out how new chart types could work and look.

Please do not use issues for support requests. For help using Chart.js, please take a look at the [`chartjs`](http://stackoverflow.com/questions/tagged/chartjs) tag on Stack Overflow.


Reporting bugs
--------------

Well structured, detailed bug reports are hugely valuable for the project.

Guidlines for reporting bugs:

- Check the issue search to see if it has already been reported
- Isolate the problem to a simple test case
- Provide a demonstration of the problem on [JS Bin](http://jsbin.com) or similar

Please provide any additional details associated with the bug, if it's browser or screen density specific, or only happens with a certain configuration or data.


Local development
-----------------

Run `npm install` to install all the libraries, then run `gulp dev --test` to build and run tests as you make changes.


Pull requests
-------------

Clear, concise pull requests are excellent at continuing the project's community driven growth. But please review [these guidelines](https://github.com/blog/1943-how-to-write-the-perfect-pull-request) and the guidelines below before starting work on the project.

Be advised that **Chart.js 1.0.2 is in feature-complete status**. Pull requests adding new features to the 1.x branch will be disregarded.

Guidelines:

- Please create an issue first:
- For bugs, we can discuss the fixing approach
- For enhancements, we can discuss if it is within the project scope and avoid duplicate effort
- Please make changes to the files in [`/src`](https://github.com/chartjs/Chart.js/tree/master/src), not `Chart.js` or `Chart.min.js` in the repo root directory, this avoids merge conflicts
- Tabs for indentation, not spaces please
- If adding new functionality, please also update the relevant `.md` file in [`/docs`](https://github.com/chartjs/Chart.js/tree/master/docs)
- Please make your commits in logical sections with clear commit messages

Joining the project
-------------
- Active committers and contributors are invited to introduce yourself and request commit access to this project. Please send an email to [email protected] or file an issue.
- We have a very active Slack community that you can join at https://chartjs-slack-automation.herokuapp.com. If you think you can help, we'd love to have you!

License
-------

By contributing your code, you agree to license your contribution under the [MIT license](https://github.com/chartjs/Chart.js/blob/master/LICENSE.md).
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The MIT License (MIT)
Copyright (c) 2016 Evert Timberg

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.
Loading

0 comments on commit c3cc699

Please sign in to comment.