Merge pull request #2868 from chakflying/update-chartjs

Chore: Update chart.js & improve performance
pull/3054/head
Louis Lam 2 years ago committed by GitHub
commit 680dccefea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

16305
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -143,8 +143,8 @@
"aedes": "^0.46.3", "aedes": "^0.46.3",
"babel-plugin-rewire": "~1.2.0", "babel-plugin-rewire": "~1.2.0",
"bootstrap": "5.1.3", "bootstrap": "5.1.3",
"chart.js": "~3.6.2", "chart.js": "~4.2.1",
"chartjs-adapter-dayjs": "~1.0.0", "chartjs-adapter-dayjs-4": "~1.0.4",
"concurrently": "^7.1.0", "concurrently": "^7.1.0",
"core-js": "~3.26.1", "core-js": "~3.26.1",
"cronstrue": "~2.24.0", "cronstrue": "~2.24.0",
@ -175,7 +175,7 @@
"vite": "~3.1.0", "vite": "~3.1.0",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vue": "~3.2.47", "vue": "~3.2.47",
"vue-chart-3": "3.0.9", "vue-chartjs": "~5.2.0",
"vue-confirm-dialog": "~1.0.2", "vue-confirm-dialog": "~1.0.2",
"vue-contenteditable": "~3.0.4", "vue-contenteditable": "~3.0.4",
"vue-i18n": "~9.2.2", "vue-i18n": "~9.2.2",

@ -11,16 +11,16 @@
</ul> </ul>
</div> </div>
<div class="chart-wrapper" :class="{ loading : loading}"> <div class="chart-wrapper" :class="{ loading : loading}">
<LineChart :chart-data="chartData" :options="chartOptions" /> <Line :data="chartData" :options="chartOptions" />
</div> </div>
</div> </div>
</template> </template>
<script lang="js"> <script lang="js">
import { BarController, BarElement, Chart, Filler, LinearScale, LineController, LineElement, PointElement, TimeScale, Tooltip } from "chart.js"; import { BarController, BarElement, Chart, Filler, LinearScale, LineController, LineElement, PointElement, TimeScale, Tooltip } from "chart.js";
import "chartjs-adapter-dayjs"; import "chartjs-adapter-dayjs-4";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { LineChart } from "vue-chart-3"; import { Line } from "vue-chartjs";
import { useToast } from "vue-toastification"; import { useToast } from "vue-toastification";
import { DOWN, PENDING, MAINTENANCE, log } from "../util.ts"; import { DOWN, PENDING, MAINTENANCE, log } from "../util.ts";
@ -29,7 +29,7 @@ const toast = useToast();
Chart.register(LineController, BarController, LineElement, PointElement, TimeScale, BarElement, LinearScale, Tooltip, Filler); Chart.register(LineController, BarController, LineElement, PointElement, TimeScale, BarElement, LinearScale, Tooltip, Filler);
export default { export default {
components: { LineChart }, components: { Line },
props: { props: {
/** ID of monitor */ /** ID of monitor */
monitorId: { monitorId: {
@ -104,8 +104,10 @@ export default {
} }
}, },
ticks: { ticks: {
sampleSize: 3,
maxRotation: 0, maxRotation: 0,
autoSkipPadding: 30, autoSkipPadding: 30,
padding: 3,
}, },
grid: { grid: {
color: this.$root.theme === "light" ? "rgba(0,0,0,0.1)" : "rgba(255,255,255,0.1)", color: this.$root.theme === "light" ? "rgba(0,0,0,0.1)" : "rgba(255,255,255,0.1)",
@ -197,6 +199,7 @@ export default {
borderColor: "#5CDD8B", borderColor: "#5CDD8B",
backgroundColor: "#5CDD8B38", backgroundColor: "#5CDD8B38",
yAxisID: "y", yAxisID: "y",
label: "ping",
}, },
{ {
// Bar Chart // Bar Chart
@ -208,6 +211,8 @@ export default {
barThickness: "flex", barThickness: "flex",
barPercentage: 1, barPercentage: 1,
categoryPercentage: 1, categoryPercentage: 1,
inflateAmount: 0.05,
label: "status",
}, },
], ],
}; };

Loading…
Cancel
Save