Skip to content

Commit

Permalink
clenaup
Browse files Browse the repository at this point in the history
  • Loading branch information
xsalonx committed Nov 8, 2024
1 parent 80ff6d7 commit 202d055
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions lib/public/components/common/chart/rendering/ChartRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,36 +109,36 @@ export class ChartRenderer {
height: 0,
};

const dependentVariable = this.isXIndexAxis ? Y_AXIS_NAME : X_AXIS_NAME;
const { [dependentVariable]: {
min: dependetnVarMin,
max: dependentVarMax,
const valueAxis = this.isXIndexAxis ? Y_AXIS_NAME : X_AXIS_NAME;
const { [valueAxis]: {
min: valueAxisMin,
max: valueAxisMax,
} } = this.getAxisConfiguration();

const indexAxisScaleFactory = new EnumerableBasedScaleFactory({ point: this.isPoint });
const dependentAxisScaleFactoryConfiguration = { forceRange: { min: dependetnVarMin, max: dependentVarMax } };
const valueAxisScaleFactoryConfiguration = { forceRange: { min: valueAxisMin, max: valueAxisMax } };
if (this._forceZero) {
dependentAxisScaleFactoryConfiguration.minimalRange = { min: 0, max: 0 };
valueAxisScaleFactoryConfiguration.minimalRange = { min: 0, max: 0 };
}
const dependantAxisScaleFactory = new RangeBasedScaleFactory(dependentAxisScaleFactoryConfiguration);
const valueAxisScaleFactory = new RangeBasedScaleFactory(valueAxisScaleFactoryConfiguration);

for (const point of data) {
indexAxisScaleFactory.processValue?.(point[indexAxis]);

if (Array.isArray(point[dependentVariable])) {
for (const value of point[dependentVariable]) {
dependantAxisScaleFactory.processValue?.(value);
if (Array.isArray(point[valueAxis])) {
for (const value of point[valueAxis]) {
valueAxisScaleFactory.processValue?.(value);
}
} else {
dependantAxisScaleFactory.processValue?.(point[dependentVariable]);
valueAxisScaleFactory.processValue?.(point[valueAxis]);
}
}

if (indexAxis === 'x') {
this._xAxisScaleFactory = indexAxisScaleFactory;
this._yAxisScaleFactory = dependantAxisScaleFactory;
this._yAxisScaleFactory = valueAxisScaleFactory;
} else {
this._xAxisScaleFactory = dependantAxisScaleFactory;
this._xAxisScaleFactory = valueAxisScaleFactory;
this._yAxisScaleFactory = indexAxisScaleFactory;
}

Expand Down Expand Up @@ -311,7 +311,7 @@ export class ChartRenderer {
}

/**
* States whether x is independnet variable
* States whether x is index variable
*
* @return {boolean} true if x is index axis, false otherwise
*/
Expand Down

0 comments on commit 202d055

Please sign in to comment.