Compare commits

...

2 Commits

Author SHA1 Message Date
vargburz 43ecf4ae78 init models 3 years ago
vargburz 50f9b43dfc try to use new core 3 years ago
  1. 3
      package.json
  2. 4
      src/index.ts
  3. 29
      src/models/bar_options.ts
  4. 29
      src/models/bar_series.ts
  5. 6
      src/types.ts
  6. 6
      yarn.lock

3
package.json

@ -6,7 +6,8 @@
"scripts": {
"build": "webpack --config build/webpack.prod.conf.js && webpack --config build/webpack.dev.conf.js",
"dev": "webpack --watch --config build/webpack.dev.conf.js",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"update-core": "yarn up @chartwerk/core && yarn up @chartwerk/core@latest"
},
"repository": {
"type": "git",

4
src/index.ts

@ -1,4 +1,4 @@
import { ChartwerkPod, VueChartwerkPodMixin, TickOrientation, TimeFormat, AxisFormat } from '@chartwerk/core';
import { ChartwerkPod, VueChartwerkPodMixin, TimeFormat, AxisFormat } from '@chartwerk/core';
import { BarTimeSerie, BarOptions, RowValues } from './types';
import { findClosest } from './utils';
@ -409,4 +409,4 @@ export const VueChartwerkBarChartObject = {
}
};
export { BarTimeSerie, BarOptions, TickOrientation, TimeFormat, AxisFormat };
export { BarTimeSerie, BarOptions, TimeFormat, AxisFormat };

29
src/models/bar_options.ts

@ -0,0 +1,29 @@
import { CoreSeries } from '@chartwerk/core';
import { ScatterData, PointType, LineType } from '../types';
import * as _ from 'lodash';
const DEFAULT_POINT_SIZE = 4;
const SCATTER_DATA_DEFAULTS = {
pointType: PointType.CIRCLE,
lineType: LineType.NONE,
pointSize: DEFAULT_POINT_SIZE,
colorFormatter: undefined
};
export class ScatterSeries extends CoreSeries<ScatterData> {
constructor(series: ScatterData[]) {
super(series);
}
protected get defaults(): ScatterData {
return { ...this._coreDefaults, ...SCATTER_DATA_DEFAULTS };
}
// move to parent
public getSerieByTarget(target: string): ScatterData | undefined {
return _.find(this.visibleSeries, serie => serie.target === target);
}
}

29
src/models/bar_series.ts

@ -0,0 +1,29 @@
import { CoreSeries } from '@chartwerk/core';
import { ScatterData, PointType, LineType } from '../types';
import * as _ from 'lodash';
const DEFAULT_POINT_SIZE = 4;
const SCATTER_DATA_DEFAULTS = {
pointType: PointType.CIRCLE,
lineType: LineType.NONE,
pointSize: DEFAULT_POINT_SIZE,
colorFormatter: undefined
};
export class ScatterSeries extends CoreSeries<ScatterData> {
constructor(series: ScatterData[]) {
super(series);
}
protected get defaults(): ScatterData {
return { ...this._coreDefaults, ...SCATTER_DATA_DEFAULTS };
}
// move to parent
public getSerieByTarget(target: string): ScatterData | undefined {
return _.find(this.visibleSeries, serie => serie.target === target);
}
}

6
src/types.ts

@ -1,10 +1,10 @@
import { TimeSerie, Options } from '@chartwerk/core';
import { Serie, Options } from '@chartwerk/core';
export type BarSerieParams = {
matchedKey: string;
colorFormatter: (serie: BarTimeSerie) => string;
colorFormatter: (serie: BarSerie) => string;
}
export type BarTimeSerie = TimeSerie & Partial<BarSerieParams>;
export type BarSerie = Serie & Partial<BarSerieParams>;
export type BarOptionsParams = {
renderBarLabels: boolean;
stacked: boolean;

6
yarn.lock

@ -20,12 +20,12 @@ __metadata:
linkType: soft
"@chartwerk/core@npm:latest":
version: 0.5.4
resolution: "@chartwerk/core@npm:0.5.4"
version: 0.6.3
resolution: "@chartwerk/core@npm:0.6.3"
dependencies:
d3: ^5.7.2
lodash: ^4.14.149
checksum: 0d686409377d6880f0012db3d9c1e1910cf3660885ac13196dabe93f57eca53984cf52dcf781b2876373fe9efc7b9d0209117cbcd811c50892b1de4f38a4a37f
checksum: bb804b1a2339fc19857e5caa07d16ed78fb1b0739878d3f7488e9f8661667ed78ada3a63afd15206bd4210746b50916b253e98f077451cc8d899728ecf08ba50
languageName: node
linkType: hard

Loading…
Cancel
Save