Browse Source

external core, d3 and lodash

merge-requests/4/head
rozetko 3 years ago
parent
commit
1ecba37236
  1. 2
      build/webpack.dev.conf.js
  2. 3
      build/webpack.prod.conf.js
  3. 2
      examples/demo.html
  4. 10
      package.json
  5. 14
      src/index.ts
  6. 243
      yarn.lock

2
build/webpack.dev.conf.js

@ -2,7 +2,7 @@ const baseWebpackConfig = require('./webpack.base.conf');
var conf = baseWebpackConfig;
conf.devtool = 'inline-source-map';
conf.watch = true;
conf.mode = 'development';
conf.output.filename = 'index.dev.js';
module.exports = conf;

3
build/webpack.prod.conf.js

@ -2,5 +2,8 @@ const baseWebpackConfig = require('./webpack.base.conf');
var conf = baseWebpackConfig;
conf.mode = 'production';
conf.externals = [
'@chartwerk/core', 'd3', 'lodash'
];
module.exports = baseWebpackConfig;

2
examples/demo.html

@ -4,7 +4,7 @@
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<script src="./dist/index.js" type="text/javascript"></script>
<script src="../dist/index.dev.js" type="text/javascript"></script>
</head>
<body>
<div id="chart" style="width: 500px; height: 500px;"></div>

10
package.json

@ -4,23 +4,19 @@
"description": "Chartwerk scatter pod",
"main": "dist/index.js",
"scripts": {
"build": "webpack --config build/webpack.prod.conf.js",
"dev": "webpack --config build/webpack.dev.conf.js",
"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"
},
"repository": {},
"author": "CorpGlory",
"license": "Apache-2.0",
"dependencies": {
"@chartwerk/core": "^0.4.0"
"@chartwerk/core": "^0.5.0-beta3"
},
"devDependencies": {
"@types/d3": "^5.7.2",
"@types/lodash": "^4.14.149",
"css-loader": "^3.4.2",
"d3": "^5.15.0",
"d3-delaunay": "^6.0.2",
"lodash": "^4.17.15",
"style-loader": "^1.1.3",
"ts-loader": "^6.2.1",
"typescript": "^3.8.3",

14
src/index.ts

@ -1,5 +1,5 @@
import { ChartwerkPod, VueChartwerkPodMixin, TickOrientation, TimeFormat, yAxisOrientation, CrosshairOrientation, PanOrientation } from '@chartwerk/core';
import { ScatterData, ScatterOptions, PointType, LineType, ColorFormatter } from './types';
import { ChartwerkPod, VueChartwerkPodMixin, TickOrientation, TimeFormat, yAxisOrientation, CrosshairOrientation } from '@chartwerk/core';
import { ScatterData, ScatterOptions, PointType, LineType } from './types';
import { DelaunayDiagram } from './delaunay';
@ -19,7 +19,7 @@ export class ChartwerkScatterPod extends ChartwerkPod<ScatterData, ScatterOption
_delaunayDiagram: DelaunayDiagram;
constructor(el: HTMLElement, _series: ScatterData[] = [], _options: ScatterOptions = {}) {
super(d3, el, _series, _options);
super(el, _series, _options);
}
renderMetrics(): void {
@ -101,7 +101,7 @@ export class ChartwerkScatterPod extends ChartwerkPod<ScatterData, ScatterOption
if(lineType === LineType.DASHED) {
strokeDasharray = DEFAULT_LINE_DASHED_AMOUNT;
}
const lineGenerator = this.d3.line()
const lineGenerator = d3.line()
.x((d: [number, number]) => this.xScale(d[0]))
.y((d: [number, number]) => this.getYScale(orientation)(d[1]));
@ -283,7 +283,7 @@ export class ChartwerkScatterPod extends ChartwerkPod<ScatterData, ScatterOption
}
onMouseMove(): void {
const mousePosition = this.d3.mouse(this.chartContainer.node());
const mousePosition = d3.mouse(this.chartContainer.node());
const eventX = mousePosition[0];
const eventY = mousePosition[1];
@ -305,8 +305,8 @@ export class ChartwerkScatterPod extends ChartwerkPod<ScatterData, ScatterOption
}
// TODO: group fields
this.options.eventsCallbacks.mouseMove({
x: this.d3.event.clientX,
y: this.d3.event.clientY,
x: d3.event.clientX,
y: d3.event.clientY,
xval: this.xScale.invert(eventX),
yval: this.xScale.invert(eventY),
highlighted,

243
yarn.lock

@ -2,242 +2,19 @@
# yarn lockfile v1
"@chartwerk/core@^0.4.0":
version "0.4.1"
resolved "https://registry.yarnpkg.com/@chartwerk/core/-/core-0.4.1.tgz#c09f72a5c74911d3a760a814bdcec13d7b421fd6"
integrity sha512-t8axHIl5RnmEdQtOAWAQYfyVtc8+XOVz080ooIPbeLuAbC3n4647tgju4p0tOWnhqYNVP7vM1GIptqWYzLwx3w==
"@types/d3-array@^1":
version "1.2.8"
resolved "https://registry.npmjs.org/@types/d3-array/-/d3-array-1.2.8.tgz"
integrity sha512-wWV0wT6oLUGprrOR5LMK7Dh8EBiondhnqINsvazv6UucYfTdb2oaFF4knlqzZV2RKB9ZC9G7G1Iojt8b/wolsw==
"@types/d3-axis@^1":
version "1.0.14"
resolved "https://registry.npmjs.org/@types/d3-axis/-/d3-axis-1.0.14.tgz"
integrity sha512-wZAKX/dtFT5t5iuCaiU0QL0BWB19TE6h7C7kgfBVyoka7zidQWvf8E9zQTJ5bNPBQxd0+JmplNqwy1M8O8FOjA==
dependencies:
"@types/d3-selection" "^1"
"@types/d3-brush@^1":
version "1.1.4"
resolved "https://registry.npmjs.org/@types/d3-brush/-/d3-brush-1.1.4.tgz"
integrity sha512-2t8CgWaha9PsPdSZJ9m6Jl4awqf3DGIXek2e7gfheyfP2R0a/18MX+wuLHx+LyI1Ad7lxDsPWcswKD0XhQEjmg==
dependencies:
"@types/d3-selection" "^1"
"@types/d3-chord@^1":
version "1.0.10"
resolved "https://registry.npmjs.org/@types/d3-chord/-/d3-chord-1.0.10.tgz"
integrity sha512-U6YojfET6ITL1/bUJo+/Lh3pMV9XPAfOWwbshl3y3RlgAX9VO/Bxa13IMAylZIDY4VsA3Gkh29kZP1AcAeyoYA==
"@types/d3-collection@*":
version "1.0.10"
resolved "https://registry.npmjs.org/@types/d3-collection/-/d3-collection-1.0.10.tgz"
integrity sha512-54Fdv8u5JbuXymtmXm2SYzi1x/Svt+jfWBU5junkhrCewL92VjqtCBDn97coBRVwVFmYNnVTNDyV8gQyPYfm+A==
"@types/d3-color@^1":
version "1.4.1"
resolved "https://registry.npmjs.org/@types/d3-color/-/d3-color-1.4.1.tgz"
integrity sha512-xkPLi+gbgUU9ED6QX4g6jqYL2KCB0/3AlM+ncMGqn49OgH0gFMY/ITGqPF8HwEiLzJaC+2L0I+gNwBgABv1Pvg==
"@types/d3-contour@^1":
version "1.3.1"
resolved "https://registry.npmjs.org/@types/d3-contour/-/d3-contour-1.3.1.tgz"
integrity sha512-wWwsM/3NfKTRBdH00cSf+XlsaHlNTkvH66PgDedobyvKQZ4sJrXXpr16LXvDnAal4B67v8JGrWDgyx6dqqKLuQ==
dependencies:
"@types/d3-array" "^1"
"@types/geojson" "*"
"@types/d3-dispatch@^1":
version "1.0.9"
resolved "https://registry.npmjs.org/@types/d3-dispatch/-/d3-dispatch-1.0.9.tgz"
integrity sha512-zJ44YgjqALmyps+II7b1mZLhrtfV/FOxw9owT87mrweGWcg+WK5oiJX2M3SYJ0XUAExBduarysfgbR11YxzojQ==
"@types/d3-drag@^1":
version "1.2.5"
resolved "https://registry.npmjs.org/@types/d3-drag/-/d3-drag-1.2.5.tgz"
integrity sha512-7NeTnfolst1Js3Vs7myctBkmJWu6DMI3k597AaHUX98saHjHWJ6vouT83UrpE+xfbSceHV+8A0JgxuwgqgmqWw==
dependencies:
"@types/d3-selection" "^1"
"@types/d3-dsv@^1":
version "1.2.1"
resolved "https://registry.npmjs.org/@types/d3-dsv/-/d3-dsv-1.2.1.tgz"
integrity sha512-LLmJmjiqp/fTNEdij5bIwUJ6P6TVNk5hKM9/uk5RPO2YNgEu9XvKO0dJ7Iqd3psEdmZN1m7gB1bOsjr4HmO2BA==
"@types/d3-ease@^1":
version "1.0.10"
resolved "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-1.0.10.tgz"
integrity sha512-fMFTCzd8DOwruE9zlu2O8ci5ct+U5jkGcDS+cH+HCidnJlDs0MZ+TuSVCFtEzh4E5MasItwy+HvgoFtxPHa5Cw==
"@types/d3-fetch@^1":
version "1.2.2"
resolved "https://registry.npmjs.org/@types/d3-fetch/-/d3-fetch-1.2.2.tgz"
integrity sha512-rtFs92GugtV/NpiJQd0WsmGLcg52tIL0uF0bKbbJg231pR9JEb6HT4AUwrtuLq3lOeKdLBhsjV14qb0pMmd0Aw==
dependencies:
"@types/d3-dsv" "^1"
"@types/d3-force@^1":
version "1.2.2"
resolved "https://registry.npmjs.org/@types/d3-force/-/d3-force-1.2.2.tgz"
integrity sha512-TN7KO7sk0tJauedIt0q20RQRFo4V3v97pJKO/TDK40X3LaPM1aXRM2+zFF+nRMtseEiszg4KffudhjR8a3+4cg==
"@types/d3-format@^1":
version "1.4.1"
resolved "https://registry.npmjs.org/@types/d3-format/-/d3-format-1.4.1.tgz"
integrity sha512-ss9G2snEKmp2In5Z3T0Jpqv8QaDBc2xHltBw83KjnV5B5w+Iwphbvq5ph/Xnu4d03fmmsdt+o1aWch379rxIbA==
"@types/d3-geo@^1":
version "1.12.1"
resolved "https://registry.npmjs.org/@types/d3-geo/-/d3-geo-1.12.1.tgz"
integrity sha512-8+gyGFyMCXIHtnMNKQDT++tZ4XYFXgiP5NK7mcv34aYXA16GQFiBBITjKzxghpO8QNVceOd9rUn1JY92WLNGQw==
"@chartwerk/core@^0.5.0-beta3":
version "0.5.0-beta3"
resolved "https://registry.yarnpkg.com/@chartwerk/core/-/core-0.5.0-beta3.tgz#861f5c022eb180fba70fc8eacd5ab977e5ea55e9"
integrity sha512-Z8XvVoDgMre+E880SHQKy+1PsKT0Vq4Jp2JumJVsFvUx2rYBAxcR9OUmA36t2i/1+nblXF7lisnix0xq5K8VyA==
dependencies:
"@types/geojson" "*"
"@types/d3-hierarchy@^1":
version "1.1.7"
resolved "https://registry.npmjs.org/@types/d3-hierarchy/-/d3-hierarchy-1.1.7.tgz"
integrity sha512-fvht6DOYKzqmXjMb/+xfgkmrWM4SD7rMA/ZbM+gGwr9ZTuIDfky95J8CARtaJo/ExeWyS0xGVdL2gqno2zrQ0Q==
"@types/d3-interpolate@^1":
version "1.4.2"
resolved "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-1.4.2.tgz"
integrity sha512-ylycts6llFf8yAEs1tXzx2loxxzDZHseuhPokrqKprTQSTcD3JbJI1omZP1rphsELZO3Q+of3ff0ZS7+O6yVzg==
dependencies:
"@types/d3-color" "^1"
"@types/d3-path@^1":
version "1.0.9"
resolved "https://registry.npmjs.org/@types/d3-path/-/d3-path-1.0.9.tgz"
integrity sha512-NaIeSIBiFgSC6IGUBjZWcscUJEq7vpVu7KthHN8eieTV9d9MqkSOZLH4chq1PmcKy06PNe3axLeKmRIyxJ+PZQ==
"@types/d3-polygon@^1":
version "1.0.8"
resolved "https://registry.npmjs.org/@types/d3-polygon/-/d3-polygon-1.0.8.tgz"
integrity sha512-1TOJPXCBJC9V3+K3tGbTqD/CsqLyv/YkTXAcwdsZzxqw5cvpdnCuDl42M4Dvi8XzMxZNCT9pL4ibrK2n4VmAcw==
"@types/d3-quadtree@^1":
version "1.0.8"
resolved "https://registry.npmjs.org/@types/d3-quadtree/-/d3-quadtree-1.0.8.tgz"
integrity sha512-FuqYiexeSQZlc+IcGAVK8jSJKDFKHcSf/jx8rqJUUVx6rzv7ecQiXKyatrLHHh3W4CAvgNeVI23JKgk4+x2wFg==
"@types/d3-random@^1":
version "1.1.3"
resolved "https://registry.npmjs.org/@types/d3-random/-/d3-random-1.1.3.tgz"
integrity sha512-XXR+ZbFCoOd4peXSMYJzwk0/elP37WWAzS/DG+90eilzVbUSsgKhBcWqylGWe+lA2ubgr7afWAOBaBxRgMUrBQ==
"@types/d3-scale-chromatic@^1":
version "1.5.1"
resolved "https://registry.npmjs.org/@types/d3-scale-chromatic/-/d3-scale-chromatic-1.5.1.tgz"
integrity sha512-7FtJYrmXTEWLykShjYhoGuDNR/Bda0+tstZMkFj4RRxUEryv16AGh3be21tqg84B6KfEwiZyEpBcTyPyU+GWjg==
"@types/d3-scale@^2":
version "2.2.4"
resolved "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-2.2.4.tgz"
integrity sha512-wkQXT+IfgfAnKB5rtS1qMJg3FS32r1rVFHvqtiqk8pX8o5aQR3VwX1P7ErHjzNIicTlkWsaMiUTrYB+E75HFeA==
dependencies:
"@types/d3-time" "^1"
"@types/d3-selection@^1":
version "1.4.3"
resolved "https://registry.npmjs.org/@types/d3-selection/-/d3-selection-1.4.3.tgz"
integrity sha512-GjKQWVZO6Sa96HiKO6R93VBE8DUW+DDkFpIMf9vpY5S78qZTlRRSNUsHr/afDpF7TvLDV7VxrUFOWW7vdIlYkA==
"@types/d3-shape@^1":
version "1.3.5"
resolved "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-1.3.5.tgz"
integrity sha512-aPEax03owTAKynoK8ZkmkZEDZvvT4Y5pWgii4Jp4oQt0gH45j6siDl9gNDVC5kl64XHN2goN9jbYoHK88tFAcA==
dependencies:
"@types/d3-path" "^1"
"@types/d3-time-format@^2":
version "2.3.1"
resolved "https://registry.npmjs.org/@types/d3-time-format/-/d3-time-format-2.3.1.tgz"
integrity sha512-fck0Z9RGfIQn3GJIEKVrp15h9m6Vlg0d5XXeiE/6+CQiBmMDZxfR21XtjEPuDeg7gC3bBM0SdieA5XF3GW1wKA==
"@types/d3-time@^1":
version "1.1.1"
resolved "https://registry.npmjs.org/@types/d3-time/-/d3-time-1.1.1.tgz"
integrity sha512-ULX7LoqXTCYtM+tLYOaeAJK7IwCT+4Gxlm2MaH0ErKLi07R5lh8NHCAyWcDkCCmx1AfRcBEV6H9QE9R25uP7jw==
"@types/d3-timer@^1":
version "1.0.10"
resolved "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-1.0.10.tgz"
integrity sha512-ZnAbquVqy+4ZjdW0cY6URp+qF/AzTVNda2jYyOzpR2cPT35FTXl78s15Bomph9+ckOiI1TtkljnWkwbIGAb6rg==
"@types/d3-transition@^1":
version "1.3.1"
resolved "https://registry.npmjs.org/@types/d3-transition/-/d3-transition-1.3.1.tgz"
integrity sha512-U9CpMlTL/NlqdGXBlHYxTZwbmy/vN1cFv8TuAIFPX+xOW/1iChbeJBY2xmINhDQfkGJbgkH4IovafCwI1ZDrgg==
dependencies:
"@types/d3-selection" "^1"
"@types/d3-voronoi@*":
version "1.1.9"
resolved "https://registry.npmjs.org/@types/d3-voronoi/-/d3-voronoi-1.1.9.tgz"
integrity sha512-DExNQkaHd1F3dFPvGA/Aw2NGyjMln6E9QzsiqOcBgnE+VInYnFBHBBySbZQts6z6xD+5jTfKCP7M4OqMyVjdwQ==
"@types/d3-zoom@^1":
version "1.8.2"
resolved "https://registry.npmjs.org/@types/d3-zoom/-/d3-zoom-1.8.2.tgz"
integrity sha512-rU0LirorUxkLxEHSzkFs7pPC0KWsxRGc0sHrxEDR0/iQq+7/xpNkKuuOOwthlgvOtpOvtTLJ2JFOD6Kr0Si4Uw==
dependencies:
"@types/d3-interpolate" "^1"
"@types/d3-selection" "^1"
"@types/d3@^5.7.2":
version "5.16.4"
resolved "https://registry.npmjs.org/@types/d3/-/d3-5.16.4.tgz"
integrity sha512-2u0O9iP1MubFiQ+AhR1id4Egs+07BLtvRATG6IL2Gs9+KzdrfaxCKNq5hxEyw1kxwsqB/lCgr108XuHcKtb/5w==
dependencies:
"@types/d3-array" "^1"
"@types/d3-axis" "^1"
"@types/d3-brush" "^1"
"@types/d3-chord" "^1"
"@types/d3-collection" "*"
"@types/d3-color" "^1"
"@types/d3-contour" "^1"
"@types/d3-dispatch" "^1"
"@types/d3-drag" "^1"
"@types/d3-dsv" "^1"
"@types/d3-ease" "^1"
"@types/d3-fetch" "^1"
"@types/d3-force" "^1"
"@types/d3-format" "^1"
"@types/d3-geo" "^1"
"@types/d3-hierarchy" "^1"
"@types/d3-interpolate" "^1"
"@types/d3-path" "^1"
"@types/d3-polygon" "^1"
"@types/d3-quadtree" "^1"
"@types/d3-random" "^1"
"@types/d3-scale" "^2"
"@types/d3-scale-chromatic" "^1"
"@types/d3-selection" "^1"
"@types/d3-shape" "^1"
"@types/d3-time" "^1"
"@types/d3-time-format" "^2"
"@types/d3-timer" "^1"
"@types/d3-transition" "^1"
"@types/d3-voronoi" "*"
"@types/d3-zoom" "^1"
"@types/geojson@*":
version "7946.0.7"
resolved "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.7.tgz"
integrity sha512-wE2v81i4C4Ol09RtsWFAqg3BUitWbHSpSlIo+bNdsCJijO9sjme+zm+73ZMCa/qMC8UEERxzGbvmr1cffo2SiQ==
d3 "^5.7.2"
lodash "^4.17.21"
"@types/json-schema@^7.0.5":
version "7.0.7"
resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz"
integrity sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==
"@types/lodash@^4.14.149":
version "4.14.168"
resolved "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.168.tgz"
integrity sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q==
"@webassemblyjs/ast@1.9.0":
version "1.9.0"
resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz"
@ -1196,9 +973,9 @@ d3-zoom@1:
d3-selection "1"
d3-transition "1"
d3@^5.15.0:
d3@^5.7.2:
version "5.16.0"
resolved "https://registry.npmjs.org/d3/-/d3-5.16.0.tgz"
resolved "https://registry.yarnpkg.com/d3/-/d3-5.16.0.tgz#9c5e8d3b56403c79d4ed42fbd62f6113f199c877"
integrity sha512-4PL5hHaHwX4m7Zr1UapXW23apo6pexCgdetdJ5kTmADpG/7T9Gkxw0M0tf/pjoB63ezCCm0u5UaFYy2aMt0Mcw==
dependencies:
d3-array "1"
@ -2036,9 +1813,9 @@ locate-path@^3.0.0:
p-locate "^3.0.0"
path-exists "^3.0.0"
lodash@^4.17.15:
lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
lru-cache@^5.1.1:

Loading…
Cancel
Save