Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
theiliad committed Sep 19, 2019
1 parent 29a2d1f commit 1643bb1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions packages/core/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ <h3>A reusable framework-agnostic D3 charting library.</h3>
</div> -->

<!-- Line Chart -->
<!-- <div class="demo-chart-holder has-actions" id="classy-curved-line-chart-holder"></div>
<div class="demo-chart-holder has-actions" id="classy-curved-line-chart-holder"></div>
<div class="chart-demo-actions" id="actions-curved-line" role="region" aria-label="Curved line chart actions">
<button class="bx--btn bx--btn--primary" id="change-data-curved-line" type="button">
Update Data
Expand All @@ -232,7 +232,7 @@ <h3>A reusable framework-agnostic D3 charting library.</h3>
<button class="bx--btn bx--btn--primary" id="change-data-scatter" type="button">
Update Data
</button>
</div> -->
</div>

<!-- <div class="demo-chart-holder has-actions" id="classy-scatter-time-chart-holder"></div>
<div class="chart-demo-actions" id="actions-scatter" role="region" aria-label="Scatter chart actions">
Expand Down
9 changes: 4 additions & 5 deletions packages/core/src/components/axes/axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,17 @@ export class Axis extends Component {
const { position } = this.configs;
const scaleOptions = Tools.getProperty(this.model.getOptions(), "axes", position);

const { datasets, labels } = this.model.getDisplayData();

// If scale is a LABELS scale, return some labels as the domain
if (scaleOptions && scaleOptions.type === ScaleTypes.LABELS) {
const labels = this.model.getDisplayData().labels;
if (labels) {
return labels;
} else {
return this.model.getDisplayData().datasets[0].data.map((d, i) => i + 1);
}
}

const { datasets, labels } = this.model.getDisplayData();

// Get the extent of the domain
let domain;
// If the scale is stacked
Expand All @@ -97,7 +96,7 @@ export class Axis extends Component {
labels.reduce((m, label: any, i) => {
const correspondingValues = datasets.map(dataset => dataset.data[i]);
const totalValue = correspondingValues.reduce((a, b) => a + b, 0);

// Save both the total value and the minimum
return m.concat(totalValue, min(correspondingValues));
}, [])
Expand Down Expand Up @@ -155,7 +154,7 @@ export class Axis extends Component {
if (axisOptions && axisOptions.type === ScaleTypes.LABELS) {
scale.rangeRound([startPosition, endPosition]);
} else {
scale.range([startPosition, endPosition])
scale.range([startPosition, endPosition]);
// .nice();
}

Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ const axisChart: AxisChartOptions = Tools.merge({}, baseOptions, {
* options specific to line charts
*/
const stackedBarChart: BarChartOptions = Tools.merge({}, axisChart, {

});
} as BarChartOptions);

/**
* options specific to line charts
Expand Down
24 changes: 13 additions & 11 deletions packages/core/src/interfaces/charts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,8 @@ export interface AxisChartOptions extends BaseChartOptions {
* options specific to line charts
*/
export interface BarChartOptions extends AxisChartOptions {
bars?: {

}

/**
* options specific to line charts
*/
export interface LineChartOptions extends ScatterChartOptions {
/**
* options for the curve of the line
*/
curve?: string | {
name: string;
};
}

Expand All @@ -89,3 +79,15 @@ export interface ScatterChartOptions extends AxisChartOptions {
fillOpacity?: number;
};
}

/**
* options specific to line charts
*/
export interface LineChartOptions extends ScatterChartOptions {
/**
* options for the curve of the line
*/
curve?: string | {
name: string;
};
}

0 comments on commit 1643bb1

Please sign in to comment.