Merge pull request #3701 from NoelDeMartin/MOBILE-4273

[4.3] MOBILE-4273 core: Lazy-load ChartJS
main
Dani Palou 2023-06-13 10:01:59 +02:00 committed by GitHub
commit d0e1169f26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -0,0 +1,15 @@
// (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
export { Chart } from 'chart.js';

View File

@ -16,7 +16,7 @@ import { Component, Input, OnDestroy, OnInit, ElementRef, OnChanges, ViewChild,
import { CoreFilter } from '@features/filter/services/filter';
import { CoreFilterHelper } from '@features/filter/services/filter-helper';
import { CoreUtils } from '@services/utils/utils';
import { Chart, ChartLegendLabelItem, ChartLegendOptions } from 'chart.js';
import { ChartLegendLabelItem, ChartLegendOptions } from 'chart.js';
/**
* This component shows a chart using chart.js.
@ -99,6 +99,8 @@ export class CoreChartComponent implements OnDestroy, OnInit, OnChanges {
return;
}
const { Chart } = await import('./chart.lazy');
this.chart = new Chart(context, {
type: this.type,
data: {