swimlane/ngx-charts

View on GitHub

Showing 208 of 208 total issues

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

  getXDomain(): any[] {
    let values = getUniqueXDomainValues(this.results);

    this.scaleType = getScaleType(values);
    let domain = [];

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

      getXDomain(): any[] {
        let values = getUniqueXDomainValues(this.results);
    
        this.scaleType = getScaleType(values);
        let domain = [];

      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 src/app/app.component.ts - About 1 hr to fix

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

          getXDomain(): any[] {
            let values = getUniqueXDomainValues(this.results);
        
            this.scaleType = getScaleType(values);
            let domain = [];

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

          export function throttle(func: any, wait: number, options?: any) {
            options = options || {};
            let context;
            let args;
            let result;
          Severity: Minor
          Found in projects/swimlane/ngx-charts/src/lib/utils/throttle.ts - About 1 hr to fix

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

              update(): void {
                super.update();
            
                if (!this.showDataLabel) {
                  this.dataLabelMaxWidth = { negative: 0, positive: 0 };

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

                update(): void {
                  const scale = this.scale;
                  this.ticks = this.getTicks();
              
                  if (this.tickFormatting) {

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

                  getToolTipText(tooltipItem: Tooltip): string {
                    let result: string = '';
                    if (tooltipItem.series !== undefined) {
                      result += tooltipItem.series;
                    } else {

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

                    updateDataLabels(): void {
                      if (this.type === BarChartType.Stacked) {
                        this.barsForDataLabels = [];
                        const section: any = {};
                        section.series = this.seriesName;

                    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 };

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

                        update(): void {
                          super.update();
                      
                          this.dims = calculateViewDimensions({
                            width: this.width,
                      Severity: Minor
                      Found in projects/swimlane/ngx-charts/src/lib/tree-map/tree-map.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 };

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

                            updateDataLabels(): void {
                              if (this.type === BarChartType.Stacked) {
                                this.barsForDataLabels = [];
                                const section: any = {};
                                section.series = this.seriesName;

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

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

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

                                getYDomain(): [number, number] {
                                  const domain = [];
                              
                                  for (const results of this.results) {
                                    for (const d of results.series) {

                              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);

                              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 getXDomainArray has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export function getXDomainArray(
                                values: Array<string | number | Date>,
                                xScaleMin?: number,
                                xScaleMax?: number
                              ): { domain: any[]; xSet: any[]; scaleType: string } {
                              Severity: Minor
                              Found in projects/swimlane/ngx-charts/src/lib/common/domain.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 update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                update(): void {
                                  let legendColumns = 0;
                                  if (this.showLegend) {
                                    this.legendType = this.getLegendType();
                              
                              

                              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 tickChunks has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                tickChunks(label: string): string[] {
                                  if (label.toString().length > this.maxTickLength && this.scale.bandwidth) {
                                    const maxAllowedLines = 5;
                              
                                    let maxLines = this.rotateTicks ? Math.floor(this.scale.step() / 14) : maxAllowedLines;

                              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 roundedRect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export function roundedRect(
                                x: number,
                                y: number,
                                w: number,
                                h: number,
                              Severity: Minor
                              Found in projects/swimlane/ngx-charts/src/lib/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

                              Severity
                              Category
                              Status
                              Source
                              Language