diff --git a/ui/app/components/chart-primitives/area.hbs b/ui/app/components/chart-primitives/area.hbs new file mode 100644 index 000000000..4ba8af25f --- /dev/null +++ b/ui/app/components/chart-primitives/area.hbs @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/ui/app/components/chart-primitives/area.js b/ui/app/components/chart-primitives/area.js new file mode 100644 index 000000000..5c5179f33 --- /dev/null +++ b/ui/app/components/chart-primitives/area.js @@ -0,0 +1,37 @@ +import Component from '@glimmer/component'; +import { default as d3Shape, area, line } from 'd3-shape'; +import uniquely from 'nomad-ui/utils/properties/uniquely'; + +export default class ChartPrimitiveArea extends Component { + get colorClass() { + return this.args.colorClass || `${this.args.colorScale}-${this.args.index}`; + } + + @uniquely('area-mask') maskId; + @uniquely('area-fill') fillId; + + get line() { + const { xScale, yScale, xProp, yProp, curveMethod } = this.args; + + const builder = line() + .curve(d3Shape[curveMethod]) + .defined(d => d[yProp] != null) + .x(d => xScale(d[xProp])) + .y(d => yScale(d[yProp])); + + return builder(this.args.data); + } + + get area() { + const { xScale, yScale, xProp, yProp, curveMethod } = this.args; + + const builder = area() + .curve(d3Shape[curveMethod]) + .defined(d => d[yProp] != null) + .x(d => xScale(d[xProp])) + .y0(yScale(0)) + .y1(d => yScale(d[yProp])); + + return builder(this.args.data); + } +} diff --git a/ui/app/components/chart-primitives/v-annotations.hbs b/ui/app/components/chart-primitives/v-annotations.hbs new file mode 100644 index 000000000..0c61c82b0 --- /dev/null +++ b/ui/app/components/chart-primitives/v-annotations.hbs @@ -0,0 +1,17 @@ +
- - - {{this.activeDatumLabel}} - - {{this.activeDatumValue}} -
+ + + {{this.activeDatumLabel}} + + {{this.activeDatumValue}} +