Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gauge #623

Merged
merged 61 commits into from
Jun 23, 2020
Merged

Gauge #623

Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
fd700e9
created gauge chart - squashed
lucamattiazzi Apr 9, 2020
6cbbb50
added to react
lucamattiazzi Apr 15, 2020
94e9439
added to all packages
lucamattiazzi Apr 15, 2020
253b829
resized gauge, corrected colors
lucamattiazzi Apr 15, 2020
d928e41
Merge branch 'master' of https://github.com/carbon-design-system/carb…
lucamattiazzi Apr 15, 2020
176f8f0
fixed tooltip
lucamattiazzi Apr 16, 2020
448b821
Merge branch 'master' of https://github.com/carbon-design-system/carb…
lucamattiazzi Apr 16, 2020
82ff6a7
two stories for gauge: circular and semicircular
lucamattiazzi Apr 17, 2020
275b76c
hidden legend
lucamattiazzi Apr 17, 2020
560152e
changed perc symbol size and position, also gauge size
lucamattiazzi Apr 17, 2020
4690a1d
distance between numbers
lucamattiazzi Apr 17, 2020
f656230
last fix for text size
lucamattiazzi Apr 17, 2020
6863cb1
carets with svgs
lucamattiazzi Apr 22, 2020
c988294
Merge branch 'master' of https://github.com/carbon-design-system/carb…
lucamattiazzi Apr 22, 2020
8584e59
fixed pixel and dominant baseline for firefox
lucamattiazzi Apr 28, 2020
2c8283c
Merge branch 'master' of https://github.com/carbon-design-system/carb…
lucamattiazzi Apr 28, 2020
d4d204c
centers caret for firefox
lucamattiazzi Apr 28, 2020
9f742ec
fixed caret size and position
lucamattiazzi May 4, 2020
0a5afb0
Merge branch 'master' of https://github.com/carbon-design-system/carb…
lucamattiazzi May 4, 2020
eae5062
adapts number size with changing of the size of the chart itself
lucamattiazzi May 5, 2020
3f34172
better handling of higher arcRatios
lucamattiazzi May 5, 2020
ab480f8
Remove arcRatio, add gauge "type"
caesarsol May 6, 2020
3fbad51
Fix sizing and centering of gauge chart
caesarsol May 6, 2020
1e35296
Fix option typings for Gauge chart
caesarsol May 6, 2020
0b7e6f1
Reorganize all sizing and positioning calculations, Simplify data format
caesarsol May 6, 2020
df69bc3
Make Gauge colors customizable from options
caesarsol May 6, 2020
fb45953
Gauge: Optical centering of the center number for the presence of the…
caesarsol May 6, 2020
cb9f0c7
Gauge: Add configuration option for arrow color
caesarsol May 6, 2020
a6e666d
Gauge type is now defaulted in configuration.ts
caesarsol May 6, 2020
dbc6d63
Fixed data format, removed tooltip service
caesarsol May 6, 2020
80696c2
Gauge: Clamp the arc at 100%
caesarsol May 6, 2020
e9b9193
Merge branch 'gauge-chart' of https://github.com/accurat/carbon-charts
natashadecoste May 8, 2020
b88565e
Merge branch 'master' of https://github.com/carbon-design-system/carb…
natashadecoste May 12, 2020
dc9c922
Revert "Update CHANGELOG.md"
natashadecoste May 19, 2020
dc5a0d0
Merge commit 'cce62aa779b97e571d93b3811d5fe96f8cc92bb1' of https://gi…
natashadecoste May 19, 2020
f80f87c
remove changelog diff
natashadecoste May 20, 2020
25d63ed
Merge branch 'master' of https://github.com/carbon-design-system/carb…
natashadecoste May 29, 2020
4a25051
update guage
natashadecoste Jun 1, 2020
8412cb7
Merge branch 'master' of https://github.com/carbon-design-system/carb…
natashadecoste Jun 8, 2020
266d7dc
formatting
natashadecoste Jun 8, 2020
fa5e496
review changes
natashadecoste Jun 8, 2020
10a7ed8
add status, arrow direction, theme & remove spacer
natashadecoste Jun 9, 2020
e5b8aad
fix guage to work without delta
natashadecoste Jun 9, 2020
f05e3a6
add enter/merge/exit for value and delta
natashadecoste Jun 9, 2020
b1ae3c5
Merge branch 'master' of https://github.com/carbon-design-system/carb…
natashadecoste Jun 9, 2020
804a741
Update packages/core/src/components/graphs/gauge.ts
natashadecoste Jun 9, 2020
fad76cd
Update packages/core/src/configuration.ts
natashadecoste Jun 10, 2020
e15b394
Merge branch 'master' of https://github.com/carbon-design-system/carb…
natashadecoste Jun 10, 2020
a447945
Merge branch 'guage' of https://github.com/natashadecoste/carbon-char…
natashadecoste Jun 10, 2020
efd064a
Merge branch 'master' of https://github.com/carbon-design-system/carb…
natashadecoste Jun 11, 2020
bec664c
review changes
natashadecoste Jun 12, 2020
410f0c5
Merge branch 'master' of https://github.com/carbon-design-system/carb…
natashadecoste Jun 12, 2020
c669535
Update packages/core/src/components/graphs/gauge.ts
natashadecoste Jun 17, 2020
e0af40a
review comments + prettier
natashadecoste Jun 17, 2020
7bf3293
Merge branch 'master' of https://github.com/carbon-design-system/carb…
natashadecoste Jun 17, 2020
53ee901
review changes
natashadecoste Jun 19, 2020
dea988e
update config names
natashadecoste Jun 19, 2020
2cf524f
Merge branch 'master' of https://github.com/carbon-design-system/carb…
natashadecoste Jun 22, 2020
3251fd3
Merge branch 'master' into guage
theiliad Jun 22, 2020
2987126
feat(gauge chart): add gauge chart to carbon-charts
natashadecoste Jun 23, 2020
5d53c40
review changes
natashadecoste Jun 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/angular/src/charts.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { GroupedBarChartComponent } from "./bar-chart-grouped.component";
import { StackedBarChartComponent } from "./bar-chart-stacked.component";
import { BubbleChartComponent } from "./bubble-chart.component";
import { DonutChartComponent } from "./donut-chart.component";
import { GaugeChartComponent } from "./gauge-chart.component";
import { LineChartComponent } from "./line-chart.component";
import { PieChartComponent } from "./pie-chart.component";
import { ScatterChartComponent } from "./scatter-chart.component";
Expand All @@ -27,6 +28,7 @@ import { RadarChartComponent } from "./radar-chart.component";
StackedBarChartComponent,
BubbleChartComponent,
DonutChartComponent,
GaugeChartComponent,
LineChartComponent,
PieChartComponent,
ScatterChartComponent,
Expand All @@ -41,6 +43,7 @@ import { RadarChartComponent } from "./radar-chart.component";
StackedBarChartComponent,
BubbleChartComponent,
DonutChartComponent,
GaugeChartComponent,
LineChartComponent,
PieChartComponent,
ScatterChartComponent,
Expand Down
34 changes: 34 additions & 0 deletions packages/angular/src/gauge-chart.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {
Component,
AfterViewInit
} from "@angular/core";

import { BaseChart } from "./base-chart.component";

import { GaugeChart } from "@carbon/charts";

/**
* Wrapper around `GaugeChart` in carbon charts library
*
* Most functions just call their equivalent from the chart library.
*/
@Component({
selector: "ibm-gauge-chart",
template: ``
})
export class GaugeChartComponent extends BaseChart implements AfterViewInit {
/**
* Runs after view init to create a chart, attach it to `elementRef` and draw it.
*/
ngAfterViewInit() {
this.chart = new GaugeChart(
this.elementRef.nativeElement,
{
data: this.data,
options: this.options
}
);

Object.assign(this, this.chart);
}
}
1 change: 1 addition & 0 deletions packages/angular/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export * from "./bar-chart-grouped.component";
export * from "./bar-chart-stacked.component";
export * from "./bubble-chart.component";
export * from "./donut-chart.component";
export * from "./gauge-chart.component";
export * from "./line-chart.component";
export * from "./pie-chart.component";
export * from "./scatter-chart.component";
Expand Down
40 changes: 20 additions & 20 deletions packages/core/demo/data/area.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const areaTimeSeriesData = [
{ group: "Dataset 3", date: new Date(2019, 0, 6), value: 37312 },
{ group: "Dataset 3", date: new Date(2019, 0, 8), value: 51432 },
{ group: "Dataset 3", date: new Date(2019, 0, 13), value: 40323 },
{ group: "Dataset 3", date: new Date(2019, 0, 19), value: 31300 },
{ group: "Dataset 3", date: new Date(2019, 0, 19), value: 31300 }
];

export const areaTimeSeriesOptions = {
Expand All @@ -22,14 +22,14 @@ export const areaTimeSeriesOptions = {
bottom: {
title: "2019 Annual Sales Figures",
mapsTo: "date",
scaleType: "time",
scaleType: "time"
},
left: {
mapsTo: "value",
title: "Conversion rate",
scaleType: "linear",
},
},
scaleType: "linear"
}
}
};

export const areaTimeSeriesCurvedData = [
Expand All @@ -42,7 +42,7 @@ export const areaTimeSeriesCurvedData = [
{ group: "Dataset 2", date: new Date(2019, 0, 5), value: 14178 },
{ group: "Dataset 2", date: new Date(2019, 0, 8), value: 23094 },
{ group: "Dataset 2", date: new Date(2019, 0, 13), value: 45281 },
{ group: "Dataset 2", date: new Date(2019, 0, 19), value: -63954 },
{ group: "Dataset 2", date: new Date(2019, 0, 19), value: -63954 }
];

export const areaTimeSeriesCurvedOptions = {
Expand All @@ -51,14 +51,14 @@ export const areaTimeSeriesCurvedOptions = {
bottom: {
title: "2019 Annual Sales Figures",
mapsTo: "date",
scaleType: "time",
scaleType: "time"
},
left: {
mapsTo: "value",
scaleType: "linear",
},
scaleType: "linear"
}
},
curve: "curveNatural",
curve: "curveNatural"
};

export const stackedAreaTimeSeriesData = [
Expand All @@ -76,20 +76,20 @@ export const stackedAreaTimeSeriesData = [
{ group: "Dataset 3", date: new Date(2019, 0, 5), value: 20000 },
{ group: "Dataset 3", date: new Date(2019, 0, 8), value: 40000 },
{ group: "Dataset 3", date: new Date(2019, 0, 13), value: 60213 },
{ group: "Dataset 3", date: new Date(2019, 0, 17), value: 25213 },
{ group: "Dataset 3", date: new Date(2019, 0, 17), value: 25213 }
];

export const stackedAreaTimeSeriesOptions = {
title: "Stacked area (time series)",
axes: {
left: {
stacked: true,
stacked: true
},
bottom: {
scaleType: "time",
},
scaleType: "time"
}
},
curve: "curveMonotoneX",
curve: "curveMonotoneX"
};

export const stackedAreaPercentageTimeSeriesOptions = {
Expand All @@ -99,13 +99,13 @@ export const stackedAreaPercentageTimeSeriesOptions = {
domain: [0, 100],
stacked: true,
ticks: {
formatter: (d) => `${d}%`,
},
formatter: (d) => `${d}%`
}
},
bottom: {
scaleType: "time",
},
scaleType: "time"
}
},
percentage: true,
curve: "curveMonotoneX",
curve: "curveMonotoneX"
};
20 changes: 10 additions & 10 deletions packages/core/demo/data/donut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export const donutOptions = {
resizable: true,
donut: {
center: {
label: "Browsers",
},
},
label: "Browsers"
}
}
};

// donut - empty state
Expand All @@ -19,9 +19,9 @@ export const donutEmptyStateOptions = {
resizable: true,
donut: {
center: {
label: "Browsers",
},
},
label: "Browsers"
}
}
};

// donut - skeleton
Expand All @@ -31,10 +31,10 @@ export const donutSkeletonOptions = {
resizable: true,
donut: {
center: {
label: "Browsers",
},
label: "Browsers"
}
},
data: {
loading: true,
},
loading: true
}
};
47 changes: 47 additions & 0 deletions packages/core/demo/data/gauge.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
export const gaugeData = [
{ group: "value", value: 42 },
{ group: "delta", value: -13.37 }
];

export const gaugeDataNoDelta = [
{ group: "value", value: 67 }
];

// guage no custom color
export const gaugeOptionsSemi = {
title: "Gauge semicircular -- danger status",
resizable: true,
height: "250px",
width: "100%",
gauge: {
type: "semi",
status: "danger"
}
};

// guage with custom color
export const gaugeOptionsCircular = {
title: "Gauge circular -- warning status",
resizable: true,
height: "250px",
gauge: {
status: "warning",
type: "full"
}
};


// guage with custom color
export const gaugeOptionsCircularNoDelta = {
title: "Gauge circular without delta",
resizable: true,
height: "250px",
gauge: {
type: "full"
},
color: {
scale: {
"value": "#891EE8"
}
}
};
Loading