Merge pull request #3701 from NoelDeMartin/MOBILE-4273
[4.3] MOBILE-4273 core: Lazy-load ChartJS
This commit is contained in:
commit
d0e1169f26
15
src/core/components/chart/chart.lazy.ts
Normal file
15
src/core/components/chart/chart.lazy.ts
Normal 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';
|
@ -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: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user