Skip to content

Commit b96f4f4

Browse files
Release v0.4.0
closes #66 closes #70
1 parent ce71db4 commit b96f4f4

7 files changed

Lines changed: 164 additions & 88 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1-
## Unreleased
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
## v0.4.0
25

36
**Added**
4-
- `highlightStyle` options parameter to customize the highlighting style for the 'elevation above' feature (horizontal line)
7+
- `highlightStyle` options parameter to customize the highlighting style
8+
for the 'elevation above' feature (horizontal line)
9+
- more documentation to README.md
10+
- babel transpiler
11+
([#70](https://github.com/GIScience/Leaflet.Heightgraph/issues/70))
12+
- minified script versions and `img` folder to distribution folder
513

614
**Changed**
715
- highlighting geometry type from multiPolyline to multiple L.polylines
16+
- default values for `height` and `margins` to the ones that are actually stated in the readme
17+
- osm tile provider to `https` instead of `http`
18+
19+
**Fixed**
20+
- security issues
21+
([#66](https://github.com/GIScience/Leaflet.Heightgraph/issues/66))
22+
- some console error where `this._pointG` was undefined
823

924
## v0.3.0 (2019-10-29)
1025

@@ -19,6 +34,7 @@
1934
- `_fitSection()` not working with round-trips
2035
- index.html not working with undefined mappings
2136
- horizontal line for height selection jumping on reselect
37+
([#42](https://github.com/GIScience/Leaflet.Heightgraph/issues/42))
2238

2339
**Changed**
2440
- version of `d3`, `grunt-contrib-jasmine` and `Leaflet` to latest
@@ -29,34 +45,53 @@
2945

3046
**API Changes**
3147

32-
* The class name `focus` was renamed to `focusbox`. `focus` might be used in many other frameworks and could lead to css conflicts. Please make sure you update the .css when updating the .js! ([#43](https://github.com/GIScience/Leaflet.Heightgraph/pull/64) by [boldtrn](https://github.com/boldtrn)).
48+
* The class name `focus` was renamed to `focusbox`.
49+
`focus` might be used in many other frameworks and could lead to css conflicts.
50+
Please make sure you update the .css when updating the .js!
51+
([#43](https://github.com/GIScience/Leaflet.Heightgraph/pull/64) by
52+
[boldtrn](https://github.com/boldtrn)).
3353

3454
## 0.1.3 (2019-07-17)
3555

3656
**Improvements**
3757

38-
* Allow customizing x and y axis ticks ([#61](https://github.com/GIScience/Leaflet.Heightgraph/pull/61) by [boldtrn](https://github.com/boldtrn)).
58+
* Allow customizing x and y axis ticks
59+
([#61](https://github.com/GIScience/Leaflet.Heightgraph/pull/61) by
60+
[boldtrn](https://github.com/boldtrn)).
3961

4062
## 0.1.2 (2019-07-17)
4163

4264
**Improvements**
4365

44-
* Callback for the expand state ([#58](https://github.com/GIScience/Leaflet.Heightgraph/pull/58) by [boldtrn](https://github.com/boldtrn)).
66+
* Callback for the expand state
67+
([#58](https://github.com/GIScience/Leaflet.Heightgraph/pull/58) by
68+
[boldtrn](https://github.com/boldtrn)).
4569

4670
## 0.1.1 (2019-07-17)
4771

4872
**Improvements**
4973

50-
* Allow defining translations for labels ([#53](https://github.com/GIScience/Leaflet.Heightgraph/pull/53) by [boldtrn](https://github.com/boldtrn)).
74+
* Allow defining translations for labels
75+
([#53](https://github.com/GIScience/Leaflet.Heightgraph/pull/53) by
76+
[boldtrn](https://github.com/boldtrn)).
5177

5278
## 0.1.0 (2019-06-22)
5379

5480
**Improvements**
5581

56-
* Allow toggling the heightgraph on Android ([#44](https://github.com/GIScience/Leaflet.Heightgraph/pull/44) by [boldtrn](https://github.com/boldtrn)).
57-
* Improve horizontal drag ([#42](https://github.com/GIScience/Leaflet.Heightgraph/pull/42) by [boldtrn](https://github.com/boldtrn)).
82+
* Allow toggling the heightgraph on Android
83+
([#44](https://github.com/GIScience/Leaflet.Heightgraph/pull/44) by
84+
[boldtrn](https://github.com/boldtrn)).
85+
* Improve horizontal drag
86+
([#42](https://github.com/GIScience/Leaflet.Heightgraph/pull/42) by
87+
[boldtrn](https://github.com/boldtrn)).
5888

5989
**API Changes**
6090

61-
* The width and height of the heightgraph now define the size of the heightgraph, and not the size of the heightgraph+margins. You might want to updated your height and width values ([#43](https://github.com/GIScience/Leaflet.Heightgraph/pull/43) by [boldtrn](https://github.com/boldtrn)).
62-
* The dependencies were refined, if you were using the plugin before, you might want to recheck that you are using the correct dependencies.
91+
* The width and height of the heightgraph now define the size of the heightgraph,
92+
and not the size of the heightgraph+margins.
93+
You might want to updated your height and width values
94+
([#43](https://github.com/GIScience/Leaflet.Heightgraph/pull/43) by
95+
[boldtrn](https://github.com/boldtrn)).
96+
* The dependencies were refined, if you were using the plugin before,
97+
you might want to recheck that you are using the correct dependencies.

‎LICENSE‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017 GIScience Research Group
3+
Copyright (c) 2019 Heidelberg Institute of Geoinformation Technology
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -14,7 +14,7 @@ copies or substantial portions of the Software.
1414

1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE

‎README.md‎

Lines changed: 113 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,46 @@
1-
# Leaflet.HeightProfile
1+
# Leaflet.Heightgraph
22

3-
![preview](https://cloud.githubusercontent.com/assets/10322094/22474104/472bcc88-e7db-11e6-8c9e-7e1d53cd0b57.png)
4-
5-
1. [What is this?](https://github.com/GIScience/Leaflet.Heightgraph#what-is-this)
6-
2. [How to use this library](https://github.com/GIScience/Leaflet.Heightgraph#how-to-use)
7-
8-
## What is this?
9-
10-
This plugin is under development and is inspired by [MrMufflon/Leaflet.Elevation](https://github.com/MrMufflon/Leaflet.Elevation).
3+
This plugin is inspired by [MrMufflon/Leaflet.Elevation](https://github.com/MrMufflon/Leaflet.Elevation).
114
You may use this plugin to view an interactive height profile of linestring segments using d3js.
125
The input data may consist of different types of attributes you wish to display.
136

7+
![preview](https://cloud.githubusercontent.com/assets/10322094/22474104/472bcc88-e7db-11e6-8c9e-7e1d53cd0b57.png)
8+
149
Supported Browsers:
1510
- Chrome
1611
- Firefox
1712
- Opera
1813

1914
[Demo](https://giscience.github.io/Leaflet.Heightgraph)
2015

21-
## Install with Bower
16+
## Installation
2217

23-
`` bower install leaflet.heightgraph ``
24-
25-
26-
## Install with npm:
27-
28-
[`nodejs`](https://nodejs.org/en/download/) (version >=8)
18+
Prerequisite: [`node`](https://nodejs.org/en/download/) (version >=8)
2919
or use [`nvm`](https://github.com/nvm-sh/nvm/blob/master/README.md) to install specific node versions
3020

31-
Install dependencies with npm. The latest version of d3 is not compatible with older browsers like IE9, you can try d3 v4 in this case.
32-
```
33-
npm install d3
34-
```
35-
36-
Install Leaflet.Heightgraph
21+
Install Leaflet.Heightgraph and dependencies with npm.
3722
```
3823
npm install leaflet.heightgraph
3924
```
4025

4126
When using NPM you can require all needed libraries like this.
4227
```
43-
require ('d3');
28+
require('d3');
29+
require('leaflet');
4430
require('leaflet.heightgraph');
4531
```
4632

33+
Alternatively you can add the required libraries in the head of your index.html file
34+
```html
35+
<link rel="stylesheet" href="node_modules/leaflet/dist/leaflet.css" />
36+
<script src="node_modules/leaflet/dist/leaflet.js"></script>
37+
<link rel="stylesheet" href="src/L.Control.Heightgraph.css"/>
38+
<script src="node_modules/d3/dist/d3.js"></script>
39+
<script type="text/javascript" src="src/L.Control.Heightgraph.js"></script>
40+
```
41+
42+
The latest version of d3 is not compatible with older browsers, you can try d3 v4 in this case.
43+
4744
## Local setup
4845

4946
```bash
@@ -58,35 +55,28 @@ $ grunt
5855
```
5956

6057
## Usage
61-
58+
Initialize the heightgraph, add it to your Leaflet map object and add your
59+
Data to the heightgraph object.
6260
```javascript
63-
// all used options are the default values
64-
var hg = L.control.heightgraph({
65-
width: 800,
66-
height: 280,
67-
margins: {
68-
top: 10,
69-
right: 30,
70-
bottom: 55,
71-
left: 50
72-
},
73-
position: "bottomright",
74-
mappings: undefined || colorMappings,
75-
highlightStyle: undefined || customStyle,
76-
translation: undefined || customTranslation
77-
});
61+
var hg = L.control.heightgraph();
7862
hg.addTo(map);
7963
hg.addData(geojson);
8064
L.geoJson(geojson).addTo(map);
8165
```
8266

8367
## Supported data
8468
Input data has to be of type [GeoJSON-Format](http://geojson.org/).
85-
This must consist of feature collection(s) corresponding to a certain attribute which could - as an example - be surface or gradient information.
86-
Each `FeatureCollection` comprises a certain `attribute` in its `properties` (e.g. `'summary': 'steepness'`) and has a list of
87-
`LineString` features with coordinates including height values and the `attributeType` which corresponds to the certain type of
88-
attribute within this segment (in this case it could be an index of steepness) declared in its `properties`.
89-
Notice that the list of coordinates has to start with the last coordinates of the previous `LineString`.
69+
This must consist of feature collection(s) corresponding to a certain
70+
attribute which could be e.g. *surface* or *gradient* information.
71+
72+
Each `FeatureCollection` comprises a certain `attribute` in its `properties`
73+
(e.g. `'summary': 'steepness'`) and has a list of `LineString` features.
74+
These should have `coordinates` including height values and the `attributeType`
75+
which corresponds to the certain type of attribute within this segment
76+
(in this case it could be an index of steepness) declared in its `properties`.
77+
78+
Notice that the list of coordinates has to start with the last coordinate
79+
of the previous `LineString`.
9080

9181
```javascript
9282
var FeatureCollections = [{
@@ -127,13 +117,77 @@ var FeatureCollections = [{
127117
```
128118

129119
## Optional settings
130-
These additional options can be set to customize your heightgraph
120+
These additional options can be set to customize your heightgraph.
121+
Use them by passing an options object to the heightgraph during creation e.g.:
122+
```js
123+
let options = {
124+
position: "topleft"
125+
}
126+
let hg = L.control.heightgraph(options);
127+
```
128+
129+
### position
130+
You can choose between `"bottomright"`, `"bottomleft"`, `"topright"` and `"topleft"`
131+
for the position on the map.
132+
133+
default: `position: "bottomright"`
134+
135+
### width
136+
The width of the expanded heightgraph display in pixels.
137+
138+
default: `width: 800`
139+
140+
### height
141+
The height of the expanded heightgraph display in pixels.
142+
143+
default: `height: 280`
144+
145+
### margins
146+
The margins define the distance between the border of the heightgraph
147+
and the actual graph inside. You are able to specify margins for `top`,
148+
`right`, `bottom` and `left` in pixels.
149+
150+
default:
151+
```
152+
margins: {
153+
top: 10,
154+
right: 30,
155+
bottom: 55,
156+
left: 50
157+
}
158+
```
159+
160+
### expand
161+
Boolean value that defines if the heightgraph should be expanded on creation.
162+
163+
default: `true`
164+
165+
expandCallback: undefined,
166+
xTicks: undefined,
167+
yTicks: undefined,
168+
}
169+
170+
### expandCallback
171+
Function to be called if the heightgraph is expanded or reduced. The state of
172+
the heightgraph is passed as an argument. It is `true` when expanded and
173+
`false` when reduced.
174+
175+
default: `undefined`
176+
177+
example:
178+
```js
179+
expandCallback: function(expanded){
180+
console.log("Expanded: " + expanded)
181+
}
182+
```
131183

132184
### mappings
133185
You may add a mappings object to customize the colors and labels in the height graph.
134186
Without adding custom mappings the segments and labels within the graph will be displayed in random colors.
135187
Each key of the object must correspond to the `summary` key in `properties` within the `FeatureCollection`.
136188

189+
default: `undefined`
190+
137191
Example:
138192

139193
```javascript
@@ -153,8 +207,11 @@ colorMappings.Steepness = {
153207
You can customize the highlight style when using the horizontal line to
154208
find parts of the route above an elevation value.
155209
Use any [Leaflet Path options](https://leafletjs.com/reference-1.5.0.html#path-option)
156-
as value of the `highlightStyle` parameter e.g:
210+
as value of the `highlightStyle` parameter.
211+
212+
default: `highlightStyle:{color: 'red'}`
157213

214+
Example:
158215
```javascript
159216
highlightStyle = {
160217
weight: 10,
@@ -163,17 +220,19 @@ highlightStyle = {
163220
}
164221
```
165222

166-
### Translation
167-
You can change the labels of the HeightGraph info field by passing a translation config e.g:
223+
### translation
224+
You can change the labels of the heightgraph info field by passing translations
225+
for `distance`, `elevation`, `segment_length`, `type` and `legend`.
168226

227+
default:
169228
```
170229
translation: {
171-
distance: "Distanz",
172-
elevation: "Höhe",
173-
segment_length: "Segment-Länge",
174-
type: "Typ",
175-
legend: "Legende"
176-
}
230+
distance: "Distance",
231+
elevation: "Elevation",
232+
segment_length: "Segment length",
233+
type: "Type",
234+
legend: "Legend"
235+
}
177236
```
178237

179238
## Debug configurations (WebStorm)

‎index-dev.html‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,12 @@
3838
const bounds = new L.LatLngBounds(new L.LatLng(47.323989, 8.108683), new L.LatLng(46.96485, 8.029803))
3939

4040
const hg = L.control.heightgraph({
41-
width: 800,
42-
height: 280,
43-
margins: {
44-
top: 10,
45-
right: 30,
46-
bottom: 55,
47-
left: 50
48-
},
4941
translation: {
5042
distance: "My custom distance"
5143
},
5244
expandCallback(expand) {
5345
console.log("Expand: "+expand)
5446
},
55-
position: "bottomright",
5647
mappings: colorMappings,
5748
highlightStyle: {
5849
color: "purple"

0 commit comments

Comments
 (0)