File

src/app/manage-learn/shared/components/scatter-chart/scatter-chart.component.ts

Implements

OnInit

Metadata

Index

Properties
Methods
Inputs

Inputs

data
Type : any
questionNumber
Type : any

Methods

ngOnInit
ngOnInit()
Returns : void

Properties

chartConstructor
Type : string
Default value : 'chart'
chartObj
oneToOneFlag
Default value : true
runOutsideAngular
Default value : false
updateFlag
Default value : false
import { Component, Input, OnInit } from '@angular/core';

@Component({
  selector: 'scatter-chart',
  templateUrl: './scatter-chart.component.html',
  styleUrls: ['./scatter-chart.component.scss'],
})
export class ScatterChartComponent implements OnInit {
  @Input() data;
  @Input() questionNumber;
  chartConstructor = 'chart'; // optional string, defaults to 'chart'
  updateFlag = false; // optional boolean
  oneToOneFlag = true; // optional boolean, defaults to false
  runOutsideAngular = false;
  chartObj;


  ngOnInit() {
    if (this.data && this.data.chart && this.data.chart.data) {
      for (const outer of this.data.chart.data) {
        for (const inner of outer.data) {
          inner.y = parseInt(inner.y);
        }
      }
    }

    this.chartObj = {
      chart: {
        plotBackgroundColor: null,
        plotBorderWidth: null,
        plotShadow: false,
        type: 'scatter',
      },
      xAxis: this.data.chart.xAxis,
      yAxis: this.data.chart.yAxis,
      title: {
        text: ' ',
      },
      tooltip: {
        // pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
      },
      plotOptions: {
        scatter: {
          lineWidth: 2,
        },
      },
      credits: {
        enabled: false,
      },
      legend: {
        enabled: false,
      },
      series: this.data ? this.data.chart.data : null,
    };
    setTimeout(() => {
    }, 1000);
  }
}
<div *ngIf="chartObj">
  <div class="heading" *ngIf="data?.question">
    <h4>{{ questionNumber }}) {{ data?.question }}</h4>
  </div>
  <div *ngIf="data?.schoolName">
    <h4 style="padding: 10px">{{ questionNumber }}. {{ data?.schoolName }}</h4>
  </div>
  <div *ngIf="data?.chart?.data">
    <div id="{{ 'container' + questionNumber }}"></div>
  </div>

  <div class="errorMsg" *ngIf="!data?.chart?.data">No data found</div>
</div>

./scatter-chart.component.scss

Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""