Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- TAILWIND
- route
- angular button
- Angular Router
- 스크롤 이벤트
- 스크롤 이벤트 감지
- flex-1
- modal
- angular route
- 검색
- summary
- 옵저버블
- angular animation
- mysql if
- 호버
- 아이오닉 스크롤 이벤트
- Ionic modal
- 셀렉트박스 커스텀
- 앵귤러 애니메이션
- formgroup
- scroll
- prisma
- Router
- angular modal
- egov spring ajax 사용 예시
- 앵귤러 모달
- ApexChart
- Oracle LISTAGG 사용 예시
- 모달
- ajax 사용 예시
Archives
- Today
- Total
깜놀하는 해므찌로
ApexChart Angular 사용 예시 본문
반응형
SMALL
<apx-chart
class="px-5 w-[48.5rem] text-gray-500"
[series]="series ?? chartOptions.series!"
[chart]="chart ?? chartOptions.chart!"
[xaxis]="xaxis ?? chartOptions.xaxis!"
[dataLabels]="labels ?? chartOptions.dataLabels!"
[stroke]="chartOptions.stroke!"
[yaxis]="yaxis ?? chartOptions.yaxis!"
[responsive]="chartOptions.responsive!"
[legend]="chartOptions.legend ?? {}"
*ngIf="!isLoading"
>
</apx-chart>
import {
Component,
OnInit,
ViewChild,
AfterViewInit,
Input,
ElementRef,
} from '@angular/core';
import { ApexResponsive, NgApexchartsModule } from 'ng-apexcharts';
import {
ChartComponent as ApexChartComponent,
ApexAxisChartSeries,
ApexChart,
ApexXAxis,
ApexDataLabels,
ApexStroke,
ApexYAxis,
ApexTitleSubtitle,
ApexLegend,
} from 'ng-apexcharts';
import { CommonModule } from '@angular/common';
import { IonicModule } from '@ionic/angular';
import { IconComponent } from '../icon/icon.component';
export type ChartOptions = {
series: ApexAxisChartSeries;
chart: ApexChart;
xaxis: ApexXAxis;
stroke: ApexStroke;
dataLabels: ApexDataLabels;
yaxis: ApexYAxis;
labels: string[];
legend: ApexLegend;
subtitle: ApexTitleSubtitle;
responsive: ApexResponsive[];
};
@Component({
selector: 'app-chart',
templateUrl: './chart.component.html',
styleUrls: ['./chart.component.scss'],
standalone: true,
imports: [NgApexchartsModule, CommonModule, IonicModule, IconComponent],
})
export class ChartComponent implements OnInit {
@Input() series: ApexAxisChartSeries | undefined;
@Input() xaxis: ApexXAxis | undefined;
@Input() yaxis: ApexYAxis | undefined;
@Input() label: string | undefined;
@Input() chart: ApexChart | undefined;
@Input() labels: ApexDataLabels | undefined;
chartOptions: Partial<ChartOptions>;
isLoading: boolean = true;
constructor() {
this.chartOptions = {
series: [
{
name: '모두',
data: [
1000, 1100, 1200, 1300, 1200, 1100, 1000, 1200, 1300, 1400, 1300,
1350,
],
color: '#002B9E',
},
{
name: '회원수',
data: [10, 50, 100, 110, 120, 120, 130, 140, 150, 165, 170, 350],
color: '#009E23',
},
{
name: '지점',
data: [1000, 900, 700, 650, 600, 650, 700, 705, 700, 600, 750, 900],
color: '#9E007A',
},
{
name: '메뉴 통계',
data: [
1500, 1300, 1200, 1100, 1000, 900, 1000, 1100, 1200, 1300, 1400,
1500,
],
color: '#9E7200',
},
],
responsive: [{ breakpoint: undefined, options: {} }],
chart: {
type: 'line',
fontFamily: 'Pretendard',
width: 776,
height: 363.5,
toolbar: {
show: false,
},
zoom: {
enabled: false,
},
},
dataLabels: {
enabled: false,
},
stroke: {
curve: 'straight',
width: 2,
},
subtitle: {
text: 'Price Movements',
align: 'left',
},
labels: ['labels'],
xaxis: {
categories: [
'1월',
'2월',
'3월',
'4월',
'5월',
'6월',
'7월',
'8월',
'9월',
'10월',
'11월',
'12월',
],
},
yaxis: {
opposite: false,
},
legend: {
show: true,
showForSingleSeries: false,
showForNullSeries: true,
showForZeroSeries: true,
position: 'top',
horizontalAlign: 'left',
floating: false,
fontSize: '1rem',
fontFamily: 'Pretendard',
fontWeight: 600,
width: 346,
height: 43,
tooltipHoverFormatter: undefined,
customLegendItems: [],
offsetX: 0,
offsetY: 0,
labels: {
colors: undefined,
useSeriesColors: false,
},
markers: {
width: 12,
height: 12,
strokeWidth: 0,
strokeColor: '',
fillColors: undefined,
radius: 12,
customHTML: undefined,
onClick: undefined,
offsetX: 0,
offsetY: 0,
},
itemMargin: {
horizontal: 16,
vertical: 0,
},
onItemClick: {
toggleDataSeries: true,
},
onItemHover: {
highlightDataSeries: true,
},
},
};
}
ngOnInit() {}
async ngAfterViewInit() {
setTimeout(() => {
this.isLoading = false;
}, 1000);
}
}
반응형
LIST
'IT' 카테고리의 다른 글
ControlValueAccessor Angular 사용 예시 / CustomValueAccessor (0) | 2023.04.24 |
---|---|
Angular [()] / 양방향 바인딩 (0) | 2023.04.24 |
C언어 조합공식 + 재귀함수 사용 예시 (1) | 2023.04.22 |
C언어 재귀함수 기본 예시 (0) | 2023.04.21 |
Ionic modal resize 예시 (0) | 2023.04.21 |