Skip to content

Commit a2f74f7

Browse files
author
Niilo Keinänen
committed
v6.0.0
1 parent 03e38b3 commit a2f74f7

File tree

4 files changed

+81
-99
lines changed

4 files changed

+81
-99
lines changed

README.md

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -90,24 +90,6 @@ mapChart.setFillStyle(
9090
)
9191
```
9292

93-
### Auto cursor formatting
94-
95-
`MapChart` cursor formatting is configured with `setCursorResultTableFormatter` method:
96-
97-
```js
98-
mapChart.setCursorResultTableFormatter((builder, region, value, longitude, latitude) => {
99-
builder.addRow(region.name)
100-
101-
// Region value is supplied to the formatter function. Note, that it is `undefined` for regions which were not invalidated by the user.
102-
if (value) {
103-
builder.addRow(`Population: `, '', `${(value / (1000 * 1000)).toFixed(1)} million`)
104-
} else {
105-
builder.addRow(`No population data available`)
106-
}
107-
return builder
108-
})
109-
```
110-
11193
**More map examples**:
11294

11395
- [Data visualization over LightningChart JS Map Charts](https://lightningchart.com/lightningchart-js-interactive-examples/examples/lcjs-example-1103-mapChartVizXY.html)
@@ -148,11 +130,11 @@ Direct developer email support can be purchased through a [Support Plan][4] or b
148130
© LightningChart Ltd 2009-2022. All rights reserved.
149131

150132

151-
[Map chart]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/classes/MapChart.html
152-
[Map types]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/variables/MapTypes.html
153-
[Paletted fill]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/classes/PalettedFill.html
154-
[Color lookup table]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/classes/LUT.html
155-
[Color RGBA]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/functions/ColorRGBA.html
156-
[Empty line]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/variables/emptyLine.html
157-
[Format longitude/latitude]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/functions/formatLongitudeLatitude.html
133+
[Map chart]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/classes/MapChart.html
134+
[Map types]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/variables/MapTypes.html
135+
[Paletted fill]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/classes/PalettedFill.html
136+
[Color lookup table]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/classes/LUT.html
137+
[Color RGBA]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/functions/ColorRGBA.html
138+
[Empty line]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/variables/emptyLine.html
139+
[Format longitude/latitude]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/functions/formatLongitudeLatitude.html
158140

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"webpack-stream": "^7.0.0"
1818
},
1919
"dependencies": {
20-
"@arction/xydata": "^1.4.0",
21-
"@arction/lcjs": "^5.2.0"
20+
"@lightningchart/lcjs": "^6.0.0",
21+
"@lightningchart/xydata": "^1.4.0"
2222
},
2323
"lightningChart": {
2424
"eID": "1101"

src/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* based on an external data set (country population).
44
*/
55
// Import LightningChartJS
6-
const lcjs = require('@arction/lcjs')
6+
const lcjs = require('@lightningchart/lcjs')
77

88
// Extract required parts from LightningChartJS.
99
const { lightningChart, MapTypes, PalettedFill, LUT, ColorRGBA, formatLongitudeLatitude, regularColorSteps, Themes } = lcjs
@@ -30,14 +30,14 @@ mapChart
3030
}),
3131
}),
3232
)
33-
.setCursorResultTableFormatter((builder, region, value, longitude, latitude) => {
34-
builder.addRow(region.name).addRow(formatLongitudeLatitude(longitude, latitude))
35-
if (value) {
36-
builder.addRow(`Population: `, '', `${(value / (1000 * 1000)).toFixed(1)} million`)
33+
.setCursorFormatting((_, hit) => {
34+
const result = [[hit.region.name], [formatLongitudeLatitude(hit.longitude, hit.latitude)]]
35+
if (hit.value) {
36+
result.push(['Population', '', `${(hit.value / (1000 * 1000)).toFixed(1)} million`])
3737
} else {
38-
builder.addRow(`No population data available`)
38+
result.push('No population data available')
3939
}
40-
return builder
40+
return result
4141
})
4242

4343
// Add Legend to show color look-up range.

webpack.config.js

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,70 @@
1-
const HtmlWebpackPlugin = require("html-webpack-plugin");
2-
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
3-
const CopyWebpackPlugin = require("copy-webpack-plugin");
4-
const path = require("path");
5-
const webpack = require('webpack');
1+
const HtmlWebpackPlugin = require('html-webpack-plugin')
2+
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
3+
const CopyWebpackPlugin = require('copy-webpack-plugin')
4+
const path = require('path')
5+
const webpack = require('webpack')
66

7-
const targetFolderName = "dist";
8-
const outputPath = path.resolve(__dirname, targetFolderName);
9-
const packageJSON = require("./package.json");
7+
const targetFolderName = 'dist'
8+
const outputPath = path.resolve(__dirname, targetFolderName)
9+
const packageJSON = require('./package.json')
1010

1111
module.exports = {
12-
mode: "development",
13-
entry: {
14-
app: packageJSON.main,
15-
},
16-
devServer: {
17-
static: outputPath,
18-
compress: true,
19-
},
20-
resolve: {
21-
modules: [path.resolve("./src"), path.resolve("./node_modules")],
22-
extensions: [".js"],
23-
},
24-
output: {
25-
filename: "js/[name].[contenthash].bundle.js",
26-
chunkFilename: "js/[name].[contenthash].bundle.js",
27-
path: outputPath,
28-
},
29-
optimization: {
30-
splitChunks: {
31-
chunks: "all",
32-
cacheGroups: {
33-
// make separate 'vendor' chunk that contains any dependencies
34-
// allows for smaller file sizes and faster builds
35-
vendor: {
36-
test: /[\\/]node_modules[\\/]/,
37-
chunks: "initial",
38-
name: "vendor",
39-
priority: -10,
40-
reuseExistingChunk: true,
41-
},
42-
},
12+
mode: 'development',
13+
entry: {
14+
app: packageJSON.main,
4315
},
44-
runtimeChunk: "single",
45-
},
46-
plugins: [
47-
new CleanWebpackPlugin(),
48-
new HtmlWebpackPlugin({
49-
title: "app",
50-
filename: path.resolve(__dirname, "dist", "index.html"),
51-
}),
52-
new CopyWebpackPlugin({
53-
patterns: [
54-
{
55-
from: "./assets/**/*",
56-
to: `./examples/assets/${packageJSON.lightningChart.eID}/[name][ext]`,
57-
noErrorOnMissing: true,
58-
},
59-
{
60-
from: "./node_modules/@arction/lcjs/dist/resources",
61-
to: "resources",
62-
noErrorOnMissing: true,
16+
devServer: {
17+
static: outputPath,
18+
compress: true,
19+
},
20+
resolve: {
21+
modules: [path.resolve('./src'), path.resolve('./node_modules')],
22+
extensions: ['.js'],
23+
},
24+
output: {
25+
filename: 'js/[name].[contenthash].bundle.js',
26+
chunkFilename: 'js/[name].[contenthash].bundle.js',
27+
path: outputPath,
28+
},
29+
optimization: {
30+
splitChunks: {
31+
chunks: 'all',
32+
cacheGroups: {
33+
// make separate 'vendor' chunk that contains any dependencies
34+
// allows for smaller file sizes and faster builds
35+
vendor: {
36+
test: /[\\/]node_modules[\\/]/,
37+
chunks: 'initial',
38+
name: 'vendor',
39+
priority: -10,
40+
reuseExistingChunk: true,
41+
},
42+
},
6343
},
64-
],
65-
}),
66-
new webpack.DefinePlugin({
67-
LCJS_LICENSE: "'" + process.env.LCJS_LICENSE + "'",
68-
}),
69-
],
70-
};
44+
runtimeChunk: 'single',
45+
},
46+
plugins: [
47+
new CleanWebpackPlugin(),
48+
new HtmlWebpackPlugin({
49+
title: 'app',
50+
filename: path.resolve(__dirname, 'dist', 'index.html'),
51+
}),
52+
new CopyWebpackPlugin({
53+
patterns: [
54+
{
55+
from: './assets/**/*',
56+
to: `./examples/assets/${packageJSON.lightningChart.eID}/[name][ext]`,
57+
noErrorOnMissing: true,
58+
},
59+
{
60+
from: './node_modules/@lightningchart/lcjs/dist/resources',
61+
to: 'resources',
62+
noErrorOnMissing: true,
63+
},
64+
],
65+
}),
66+
new webpack.DefinePlugin({
67+
LCJS_LICENSE: "'" + process.env.LCJS_LICENSE + "'",
68+
}),
69+
],
70+
}

0 commit comments

Comments
 (0)