microting/ngx-charts

View on GitHub

Showing 204 of 204 total issues

Function calcStatusData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  calcStatusData(sales = this.statusData[0].value, dur = this.statusData[2].value) {
    const ret = sales * this.salePrice;
    const cost = ((sales * dur) / 60 / 60 / 1000) * this.personnelCost;
    const ROI = (ret - cost) / cost;
    return [
Severity: Minor
Found in demo/app.component.ts - About 1 hr to fix

    Function getToolTipText has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      getToolTipText(tooltipItem: any): string {
        let result: string = '';
        if (tooltipItem.series !== undefined) {
          result += tooltipItem.series;
        } else {
    Severity: Minor
    Found in src/common/tooltip-area.component.ts - About 1 hr to fix

      Function update has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        update(): void {
          super.update();
      
          if (!this.showDataLabel) {
            this.dataLabelMaxHeight = { negative: 0, positive: 0 };
      Severity: Minor
      Found in src/bar-chart/bar-vertical.component.ts - About 1 hr to fix

        Function update has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          update(): void {
            super.update();
        
            if (!this.showDataLabel) {
              this.dataLabelMaxWidth = { negative: 0, positive: 0 };
        Severity: Minor
        Found in src/bar-chart/bar-horizontal-stacked.component.ts - About 1 hr to fix

          Function updateDataLabels has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            updateDataLabels() {
              if (this.type === 'stacked') {
                this.barsForDataLabels = [];
                const section: any = {};
                section.series = this.seriesName;
          Severity: Minor
          Found in src/bar-chart/series-horizontal.component.ts - About 1 hr to fix

            Function updateDataLabels has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              updateDataLabels() {
                if (this.type === 'stacked') {
                  this.barsForDataLabels = [];
                  const section: any = {};
                  section.series = this.seriesName;
            Severity: Minor
            Found in src/bar-chart/series-vertical.component.ts - About 1 hr to fix

              Function update has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                update(): void {
                  this.zone.run(() => {
                    const hasValue = this.data && typeof this.data.value !== 'undefined';
                    const valueFormatting = this.valueFormatting || (card => card.value.toLocaleString());
                    const labelFormatting = this.labelFormatting || (card => escapeLabel(trimLabel(card.label, 55)));
              Severity: Minor
              Found in src/number-card/card.component.ts - About 1 hr to fix

                Function roundedRect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                export function roundedRect(x, y, w, h, r, [tl, tr, bl, br]: boolean[]) {
                  let retval = '';
                
                  w = Math.floor(w);
                  h = Math.floor(h);
                Severity: Minor
                Found in src/common/shape.helper.ts - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function scaleText has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  scaleText(element, repeat: boolean = true): void {
                    let el;
                    let resizeScale;
                    if (element === 'value') {
                      el = this.valueTextEl;
                Severity: Minor
                Found in src/gauge/linear-gauge.component.ts - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function getDomain has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                export function getDomain(values, scaleType, autoScale, minVal?, maxVal?): number[] {
                    let domain: number[] = [];
                    if (scaleType === 'linear') {
                      values = values.map(v => Number(v));
                      if (!autoScale) {
                Severity: Minor
                Found in src/bubble-chart/bubble-chart.utils.ts - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function getYDomain has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  getYDomain(): any[] {
                    const domain = [];
                
                    for (const results of this.results) {
                      for (const d of results.series) {
                Severity: Minor
                Found in src/area-chart/area-chart.component.ts - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function getInnerStackedDomain has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  getInnerStackedDomain() {
                    const domain = [];
                
                    for (const group of this.results) {
                      for(const stack of group.series) {
                Severity: Minor
                Found in src/bar-chart/bar-vertical-2d-stacked.component.ts - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    update(): void {  
                      if (this.valueFormatting) {
                        this.formatedValue = this.valueFormatting(this.value);
                      } else {
                        this.formatedValue = formatLabel(this.value);  
                Severity: Minor
                Found in src/bar-chart/bar-label.component.ts - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function cloneData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  private cloneData(data): any {
                    const results = [];
                
                    for (const item of data) {
                      const copy = {
                Severity: Minor
                Found in src/common/base-chart.component.ts - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  update(): void {
                    let legendColumns = 0;
                    if (this.showLegend || this.advancedData) {
                      this.legendType = this.getLegendType();
                
                
                Severity: Minor
                Found in src/common/charts/chart.component.ts - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function update has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    update(): void {  
                      if (this.valueFormatting) {
                        this.formatedValue = this.valueFormatting(this.value);
                      } else {
                        this.formatedValue = formatLabel(this.value);  
                Severity: Minor
                Found in src/bar-chart/bar-label.component.ts - About 1 hr to fix

                  Function getYDomain has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    getYDomain(): any[] {
                      const domain = [];
                      for (const results of this.results) {
                        for (const d of results.series) {
                          if (domain.indexOf(d.value) < 0) {
                  Severity: Minor
                  Found in src/line-chart/line-chart.component.ts - About 1 hr to fix

                    Function getYDomainLine has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      getYDomainLine(): any[] {
                        const domain = [];
                    
                        for (const results of this.lineChart) {
                          for (const d of results.series) {
                    Severity: Minor
                    Found in demo/combo-chart/combo-chart.component.ts - About 1 hr to fix

                      Function getYDomain has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        getYDomain(): any[] {
                          if (this.valueDomain) {
                            return this.valueDomain;
                          }
                      
                      
                      Severity: Minor
                      Found in demo/sparkline/sparkline.component.ts - About 1 hr to fix

                        Function getCards has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          getCards(): any[] {
                            const yPadding =
                              typeof this.innerPadding === 'number' ? this.innerPadding : this.innerPadding[0] + this.innerPadding[2];
                            const xPadding =
                              typeof this.innerPadding === 'number' ? this.innerPadding : this.innerPadding[1] + this.innerPadding[3];
                        Severity: Minor
                        Found in src/number-card/card-series.component.ts - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language