Compare commits

..

No commits in common. 'main' and 'onmouseover-event-callback-#42' have entirely different histories.

  1. 2
      package.json
  2. 24
      src/index.ts
  3. 1
      src/models/series.ts
  4. 15
      src/models/state.ts

2
package.json

@ -1,6 +1,6 @@
{
"name": "@chartwerk/core",
"version": "0.6.26",
"version": "0.6.24",
"description": "Chartwerk core",
"main": "dist/index.js",
"types": "dist/index.d.ts",

24
src/index.ts

@ -79,8 +79,7 @@ class ChartwerkPod<T extends Serie, O extends Options> {
_series: T[] = [],
_options: O
) {
// need to call explicitly because option lazyStyleTag
// in webpack style-loader
// TODO: test if it's necessary
styles.use();
this.options = new CoreOptions(_options);
@ -116,7 +115,6 @@ class ChartwerkPod<T extends Serie, O extends Options> {
this.renderLegend();
this.renderYLabel();
this.renderY1Label();
this.renderXLabel();
this.options.callbackRenderEnd();
@ -510,8 +508,8 @@ class ChartwerkPod<T extends Serie, O extends Options> {
return;
}
this.chartContainer.append('text')
.attr('y', -this.margin.left)
.attr('x', -(this.height / 2))
.attr('y', 0 - this.margin.left)
.attr('x', 0 - (this.height / 2))
.attr('dy', '1em')
.attr('class', 'y-axis-label')
.attr('transform', 'rotate(-90)')
@ -521,22 +519,6 @@ class ChartwerkPod<T extends Serie, O extends Options> {
.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 {
if(this.options.axis.x.label === undefined) {
return;

1
src/models/series.ts

@ -35,7 +35,6 @@ export class CoreSeries<T extends Serie> {
_series: Array<T> = [];
constructor(series: T[], private _podDefaults?: Partial<T>) {
// TODO: create separate Serie class, and store instances in this._series
this.setSeries(series);
}

15
src/models/state.ts

@ -1,4 +1,4 @@
import { Serie, Options, yAxisOrientation } from '../types';
import { Serie, Options } from '../types';
import { CoreSeries } from './series';
import { CoreOptions } from './options';
@ -89,15 +89,6 @@ export class PodState<T extends Serie, O extends Options> {
this._transform = { x: 0, y: 0, k: 1 };
}
getYScaleByOrientation(orientation?: yAxisOrientation): d3.ScaleLinear<number, number> {
// TODO: we set defaults in Series class, so we don't expect `undefined` here
// we can remove this check when we implement Serie class (see TODO in `series.ts`)
if(orientation === undefined) {
return this._yScale;
}
return orientation === yAxisOrientation.LEFT ? this._yScale : this._y1Scale;
}
get yScale(): d3.ScaleLinear<number, number> {
return this._yScale;
}
@ -196,7 +187,7 @@ export class PodState<T extends Serie, O extends Options> {
if(this.coreOptions.axis.y1.range !== undefined) {
return min(this.coreOptions.axis.y1.range);
}
return this.coreSeries.minValueY1;
return this.coreSeries.minValueY;
}
public getMaxValueY1(): number {
@ -206,7 +197,7 @@ export class PodState<T extends Serie, O extends Options> {
if(this.coreOptions.axis.y1.range !== undefined) {
return max(this.coreOptions.axis.y1.range);
}
return this.coreSeries.maxValueY1;
return this.coreSeries.maxValueY;
}
// getters for correct transform

Loading…
Cancel
Save