Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanomackey committed Jul 28, 2020
1 parent 31aa29c commit 8732bec
Show file tree
Hide file tree
Showing 28 changed files with 310 additions and 223 deletions.
21 changes: 5 additions & 16 deletions packages/core/CHANGELOG.md
@@ -1,18 +1,15 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
All notable changes to this project will be documented in this file. See
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.34.5](https://github.com/carbon-design-system/carbon-charts/compare/v0.34.4...v0.34.5) (2020-07-22)


### Bug Fixes

* fix pie chart alignment ([#716](https://github.com/carbon-design-system/carbon-charts/issues/716)) ([638c331](https://github.com/carbon-design-system/carbon-charts/commit/638c331b7fa8fbc73cf557cf99a6b3af2435b492))




- fix pie chart alignment
([#716](https://github.com/carbon-design-system/carbon-charts/issues/716))
([638c331](https://github.com/carbon-design-system/carbon-charts/commit/638c331b7fa8fbc73cf557cf99a6b3af2435b492))

# Change Log

Expand All @@ -23,18 +20,10 @@ All notable changes to this project will be documented in this file. See

**Note:** Version bump only for package @carbon/charts





## [0.34.3](https://github.com/carbon-design-system/carbon-charts/compare/v0.34.2...v0.34.3) (2020-07-20)

**Note:** Version bump only for package @carbon/charts





## [0.34.2](https://github.com/carbon-design-system/carbon-charts/compare/v0.34.1...v0.34.2) (2020-07-15)

**Note:** Version bump only for package @carbon/charts
Expand Down
4 changes: 2 additions & 2 deletions packages/core/demo/data/bar.ts
Expand Up @@ -131,7 +131,7 @@ export const simpleBarCenteredLegendOptions = {
legend: {
alignment: "center"
}
}
};

// Simple bar with long labels
export const simpleBarLongLabelData = [
Expand Down Expand Up @@ -225,7 +225,7 @@ export const simpleHorizontalBarCenteredLegendOptions = {
legend: {
alignment: "center"
}
}
};

export const simpleHorizontalBarLongLabelOptions = {
title: "Simple horizontal bar (truncated labels)",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/demo/data/donut.ts
Expand Up @@ -26,7 +26,7 @@ export const donutCenteredOptions = {
},
alignment: "center"
}
}
};

// donut - empty state
export const donutEmptyStateData = [];
Expand Down
2 changes: 1 addition & 1 deletion packages/core/demo/data/line.ts
Expand Up @@ -58,7 +58,7 @@ export const lineCenteredLegendOptions = {
legend: {
alignment: "center"
}
}
};

export const lineLongLabelData = [
{ group: "Dataset 1", key: "Qty", value: 34200 },
Expand Down
1 change: 0 additions & 1 deletion packages/core/demo/data/meter.ts
Expand Up @@ -40,7 +40,6 @@ export const meterOptionsCustomColor = {
height: "100px"
};


export const meterOptionsNoStatus = {
title: "Meter Chart - no status",
meter: {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/demo/data/pie.ts
Expand Up @@ -23,7 +23,7 @@ export const pieCenteredOptions = {
pie: {
alignment: "center"
}
}
};

// pie - empty state
export const pieEmptyStateData = [];
Expand All @@ -50,8 +50,8 @@ export const pieErrorOptions = {
data: {
loading: false,
error: {
title: 'No data available',
subtitle: 'Lorem ipsum dolor sit.'
title: "No data available",
subtitle: "Lorem ipsum dolor sit."
}
}
};
2 changes: 1 addition & 1 deletion packages/core/demo/data/radar.ts
Expand Up @@ -41,7 +41,7 @@ export const radarCenteredOptions = {
legend: {
alignment: "center"
}
}
};

// radar with missing data
export const radarWithMissingDataData = [
Expand Down
34 changes: 13 additions & 21 deletions packages/core/src/charts/meter.ts
Expand Up @@ -45,9 +45,7 @@ export class MeterChart extends Chart {
// Specify what to render inside the graph only
const graph = {
id: "meter-graph",
components: [
new Meter(this.model, this.services)
],
components: [new Meter(this.model, this.services)],
growth: {
x: LayoutGrowth.STRETCH,
y: LayoutGrowth.FIXED
Expand All @@ -57,9 +55,7 @@ export class MeterChart extends Chart {
// Meter has an unique dataset title within the graph
const titleComponent = {
id: "title",
components: [
new MeterTitle(this.model, this.services)
],
components: [new MeterTitle(this.model, this.services)],
growth: {
x: LayoutGrowth.PREFERRED,
y: LayoutGrowth.FIXED
Expand All @@ -69,28 +65,24 @@ export class MeterChart extends Chart {
// create the title spacer
const titleSpacerComponent = {
id: "spacer",
components: [
new Spacer(this.model, this.services, {size: 8})
],
components: [new Spacer(this.model, this.services, { size: 8 })],
growth: {
x: LayoutGrowth.PREFERRED,
y: LayoutGrowth.FIXED
}
};

// the graph frame for meter includes the custom title (and spacer)
const graphFrame = [new LayoutComponent(
this.model,
this.services,
[
titleComponent,
titleSpacerComponent,
graph
],
{
direction: LayoutDirection.COLUMN
}
)];
const graphFrame = [
new LayoutComponent(
this.model,
this.services,
[titleComponent, titleSpacerComponent, graph],
{
direction: LayoutDirection.COLUMN
}
)
];

// add the meter title as a top level component
const components: any[] = this.getChartComponents(graphFrame);
Expand Down
8 changes: 6 additions & 2 deletions packages/core/src/components/axes/axis.ts
Expand Up @@ -209,7 +209,7 @@ export class Axis extends Component {
"timeScale",
"addSpaceOnEdges"
);

const customDomain = Tools.getProperty(
options,
"axes",
Expand All @@ -225,7 +225,11 @@ export class Axis extends Component {

// Remove labels on the edges
// If there are more than 2 labels to show
if (addSpaceOnEdges && tickValues.length > 2 && !customDomain) {
if (
addSpaceOnEdges &&
tickValues.length > 2 &&
!customDomain
) {
tickValues.splice(tickValues.length - 1, 1);
tickValues.splice(0, 1);
}
Expand Down
8 changes: 6 additions & 2 deletions packages/core/src/components/essentials/legend.ts
Expand Up @@ -115,9 +115,13 @@ export class Legend extends Component {
this.addEventListeners();
}

const alignment = Tools.getProperty(legendOptions,"alignment");
const alignment = Tools.getProperty(legendOptions, "alignment");

const alignmentOffset = DOMUtils.getAlignmentOffset(alignment, svg, this.getParent());
const alignmentOffset = DOMUtils.getAlignmentOffset(
alignment,
svg,
this.getParent()
);
svg.attr("transform", `translate(${alignmentOffset}, 0)`);
}

Expand Down

0 comments on commit 8732bec

Please sign in to comment.