|
|
@ -37,7 +37,7 @@ import debounce from 'lodash/debounce'; |
|
|
|
const DEFAULT_TICK_SIZE = 2; |
|
|
|
const DEFAULT_TICK_SIZE = 2; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ChartwerkPod<T extends Serie, O extends Options> { |
|
|
|
abstract class ChartwerkPod<T extends Serie, O extends Options> { |
|
|
|
|
|
|
|
|
|
|
|
protected series: CoreSeries<T>; |
|
|
|
protected series: CoreSeries<T>; |
|
|
|
protected options: CoreOptions<O>; |
|
|
|
protected options: CoreOptions<O>; |
|
|
@ -79,8 +79,7 @@ class ChartwerkPod<T extends Serie, O extends Options> { |
|
|
|
_series: T[] = [], |
|
|
|
_series: T[] = [], |
|
|
|
_options: O |
|
|
|
_options: O |
|
|
|
) { |
|
|
|
) { |
|
|
|
// need to call explicitly because option lazyStyleTag
|
|
|
|
// TODO: test if it's necessary
|
|
|
|
// in webpack style-loader
|
|
|
|
|
|
|
|
styles.use(); |
|
|
|
styles.use(); |
|
|
|
|
|
|
|
|
|
|
|
this.options = new CoreOptions(_options); |
|
|
|
this.options = new CoreOptions(_options); |
|
|
@ -116,7 +115,6 @@ class ChartwerkPod<T extends Serie, O extends Options> { |
|
|
|
|
|
|
|
|
|
|
|
this.renderLegend(); |
|
|
|
this.renderLegend(); |
|
|
|
this.renderYLabel(); |
|
|
|
this.renderYLabel(); |
|
|
|
this.renderY1Label(); |
|
|
|
|
|
|
|
this.renderXLabel(); |
|
|
|
this.renderXLabel(); |
|
|
|
|
|
|
|
|
|
|
|
this.options.callbackRenderEnd(); |
|
|
|
this.options.callbackRenderEnd(); |
|
|
@ -153,13 +151,13 @@ class ChartwerkPod<T extends Serie, O extends Options> { |
|
|
|
this.series.updateSeries(newSeries); |
|
|
|
this.series.updateSeries(newSeries); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected renderMetrics(): void {} |
|
|
|
protected abstract renderMetrics(): void; |
|
|
|
protected onMouseOver(): void {} |
|
|
|
protected abstract onMouseOver(): void; |
|
|
|
protected onMouseOut(): void {} |
|
|
|
protected abstract onMouseOut(): void; |
|
|
|
protected onMouseMove(): void {} |
|
|
|
protected abstract onMouseMove(): void; |
|
|
|
protected onMouseClick(): void {} |
|
|
|
protected abstract onMouseClick(): void; |
|
|
|
public renderSharedCrosshair(values: { x?: number, y?: number }): void {} |
|
|
|
public abstract renderSharedCrosshair(values: { x?: number, y?: number }): void; |
|
|
|
public hideSharedCrosshair(): void {} |
|
|
|
public abstract hideSharedCrosshair(): void; |
|
|
|
|
|
|
|
|
|
|
|
protected initPodState(): void { |
|
|
|
protected initPodState(): void { |
|
|
|
const boxPararms = { |
|
|
|
const boxPararms = { |
|
|
@ -510,8 +508,8 @@ class ChartwerkPod<T extends Serie, O extends Options> { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
this.chartContainer.append('text') |
|
|
|
this.chartContainer.append('text') |
|
|
|
.attr('y', -this.margin.left) |
|
|
|
.attr('y', 0 - this.margin.left) |
|
|
|
.attr('x', -(this.height / 2)) |
|
|
|
.attr('x', 0 - (this.height / 2)) |
|
|
|
.attr('dy', '1em') |
|
|
|
.attr('dy', '1em') |
|
|
|
.attr('class', 'y-axis-label') |
|
|
|
.attr('class', 'y-axis-label') |
|
|
|
.attr('transform', 'rotate(-90)') |
|
|
|
.attr('transform', 'rotate(-90)') |
|
|
@ -521,22 +519,6 @@ class ChartwerkPod<T extends Serie, O extends Options> { |
|
|
|
.text(this.options.axis.y.label); |
|
|
|
.text(this.options.axis.y.label); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected renderY1Label(): void { |
|
|
|
|
|
|
|
if(this.options.axis.y1?.label === undefined) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.chartContainer.append('text') |
|
|
|
|
|
|
|
.attr('y', -this.width - this.margin.right) |
|
|
|
|
|
|
|
.attr('x', (this.height / 2)) |
|
|
|
|
|
|
|
.attr('dy', '1em') |
|
|
|
|
|
|
|
.attr('class', 'y-axis-label') |
|
|
|
|
|
|
|
.attr('transform', 'rotate(90)') |
|
|
|
|
|
|
|
.style('text-anchor', 'middle') |
|
|
|
|
|
|
|
.style('font-size', '14px') |
|
|
|
|
|
|
|
.style('fill', 'currentColor') |
|
|
|
|
|
|
|
.text(this.options.axis.y1.label); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected renderXLabel(): void { |
|
|
|
protected renderXLabel(): void { |
|
|
|
if(this.options.axis.x.label === undefined) { |
|
|
|
if(this.options.axis.x.label === undefined) { |
|
|
|
return; |
|
|
|
return; |
|
|
|