Skip to content

Commit

Permalink
Merge pull request #97 from humangeo/feature/chartmarkerfix
Browse files Browse the repository at this point in the history
Feature/chartmarkerfix
  • Loading branch information
sfairgrieve authored Sep 28, 2016
2 parents 7201cee + 58d4207 commit 38b652f
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 37 deletions.
14 changes: 7 additions & 7 deletions dist/leaflet-dvf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4190,7 +4190,7 @@ L.BarChartMarker = L.ChartMarker.extend({
_loadComponents: function () {
var value, minValue, maxValue;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var x;
var y;
var keys = Object.keys(this.options.data);
Expand Down Expand Up @@ -4415,7 +4415,7 @@ L.PieChartMarker = L.ChartMarker.extend({
var maxDegrees = this.options.maxDegrees || 360.0;
var lastAngle = this.options.rotation;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var data = this.options.data;
var chartOptions = this.options.chartOptions;
var chartOption;
Expand Down Expand Up @@ -4512,7 +4512,7 @@ L.CoxcombChartMarker = L.CoxcombChartMarker.extend({
var maxDegrees = this.options.maxDegrees || 360.0;
var lastAngle = this.options.rotation;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var radiusX = 'radiusX' in this.options ? this.options.radiusX : this.options.radius;
var radiusY = 'radiusY' in this.options ? this.options.radiusY : this.options.radius;
var keys = Object.keys(this.options.data);
Expand Down Expand Up @@ -4611,7 +4611,7 @@ L.RadialBarChartMarker = L.ChartMarker.extend({
var angle = this.options.rotation;
var maxDegrees = this.options.maxDegrees || 360.0;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var lastRadiusX = this.options.radiusX || this.options.radius;
var lastRadiusY = this.options.radiusY || this.options.radius;
var data = this.options.data;
Expand Down Expand Up @@ -4678,12 +4678,12 @@ L.StackedRegularPolygonMarker = L.ChartMarker.extend({
var lastRadiusX = 0;
var lastRadiusY = 0;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var data = this.options.data;
var chartOptions = this.options.chartOptions;
var chartOption;
var key;

var minValue, maxValue, minRadius, maxRadius;
// Iterate through the data values
var bars = [];

Expand Down Expand Up @@ -4783,7 +4783,7 @@ L.RadialMeterMarker = L.ChartMarker.extend({
var startAngle = this.options.rotation;
var maxDegrees = this.options.maxDegrees || 360.0;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var radiusX = this.options.radiusX || this.options.radius;
var radiusY = this.options.radiusY || this.options.radius;
var data = this.options.data;
Expand Down
14 changes: 7 additions & 7 deletions dist/leaflet-dvf.markers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4085,7 +4085,7 @@ L.BarChartMarker = L.ChartMarker.extend({
_loadComponents: function () {
var value, minValue, maxValue;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var x;
var y;
var keys = Object.keys(this.options.data);
Expand Down Expand Up @@ -4310,7 +4310,7 @@ L.PieChartMarker = L.ChartMarker.extend({
var maxDegrees = this.options.maxDegrees || 360.0;
var lastAngle = this.options.rotation;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var data = this.options.data;
var chartOptions = this.options.chartOptions;
var chartOption;
Expand Down Expand Up @@ -4407,7 +4407,7 @@ L.CoxcombChartMarker = L.CoxcombChartMarker.extend({
var maxDegrees = this.options.maxDegrees || 360.0;
var lastAngle = this.options.rotation;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var radiusX = 'radiusX' in this.options ? this.options.radiusX : this.options.radius;
var radiusY = 'radiusY' in this.options ? this.options.radiusY : this.options.radius;
var keys = Object.keys(this.options.data);
Expand Down Expand Up @@ -4506,7 +4506,7 @@ L.RadialBarChartMarker = L.ChartMarker.extend({
var angle = this.options.rotation;
var maxDegrees = this.options.maxDegrees || 360.0;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var lastRadiusX = this.options.radiusX || this.options.radius;
var lastRadiusY = this.options.radiusY || this.options.radius;
var data = this.options.data;
Expand Down Expand Up @@ -4573,12 +4573,12 @@ L.StackedRegularPolygonMarker = L.ChartMarker.extend({
var lastRadiusX = 0;
var lastRadiusY = 0;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var data = this.options.data;
var chartOptions = this.options.chartOptions;
var chartOption;
var key;

var minValue, maxValue, minRadius, maxRadius;
// Iterate through the data values
var bars = [];

Expand Down Expand Up @@ -4678,7 +4678,7 @@ L.RadialMeterMarker = L.ChartMarker.extend({
var startAngle = this.options.rotation;
var maxDegrees = this.options.maxDegrees || 360.0;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var radiusX = this.options.radiusX || this.options.radius;
var radiusY = this.options.radiusY || this.options.radius;
var data = this.options.data;
Expand Down
4 changes: 2 additions & 2 deletions dist/leaflet-dvf.markers.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/leaflet-dvf.min.js

Large diffs are not rendered by default.

42 changes: 30 additions & 12 deletions examples/js/markers.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,14 @@ $(document).ready(function() {
numSegments: 10
};

return new L.RadialMeterMarker(latlng, meterMarkerOptions);
var marker = new L.RadialMeterMarker(latlng, meterMarkerOptions);

marker.on('click', function (e) {
this.options.data.Speed = Math.random() * 200;
this.redraw();
});

return marker;
});

addMarkers('Bar Charts', 0.0, 14.0, 2.0, 5, function (latlng) {
Expand Down Expand Up @@ -494,18 +501,16 @@ $(document).ready(function() {

var barChart = new L.BarChartMarker(latlng, options);

var updateFunction = function () {
barChart.options.data = {
'dataPoint1': Math.random() * 20,
'dataPoint2': Math.random() * 20,
'dataPoint3': Math.random() * 20,
'dataPoint4': Math.random() * 20
barChart.on('click', function (e) {
this.options.data = {
'dataPoint1': Math.random() * 20,
'dataPoint2': Math.random() * 20,
'dataPoint3': Math.random() * 20,
'dataPoint4': Math.random() * 20
};

barChart.redraw();
};

//setInterval(updateFunction, 1000);
this.redraw();
});

return barChart;
});
Expand Down Expand Up @@ -708,7 +713,20 @@ $(document).ready(function() {
}
};

return new L.RadialBarChartMarker(latlng, options);
var radialChartMarker = new L.RadialBarChartMarker(latlng, options);

radialChartMarker.on('click', function (e) {
this.options.data = {
'dataPoint1': Math.random() * 20,
'dataPoint2': Math.random() * 20,
'dataPoint3': Math.random() * 20,
'dataPoint4': Math.random() * 20
};

this.redraw();
});

return radialChartMarker;
});

addMarkers('Stacked Regular Polygons', -8.0, 14.0, 2.0, 5, function (latlng, index) {
Expand Down
14 changes: 7 additions & 7 deletions src/leaflet.dvf.chartmarkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ L.BarChartMarker = L.ChartMarker.extend({
_loadComponents: function () {
var value, minValue, maxValue;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var x;
var y;
var keys = Object.keys(this.options.data);
Expand Down Expand Up @@ -471,7 +471,7 @@ L.PieChartMarker = L.ChartMarker.extend({
var maxDegrees = this.options.maxDegrees || 360.0;
var lastAngle = this.options.rotation;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var data = this.options.data;
var chartOptions = this.options.chartOptions;
var chartOption;
Expand Down Expand Up @@ -568,7 +568,7 @@ L.CoxcombChartMarker = L.CoxcombChartMarker.extend({
var maxDegrees = this.options.maxDegrees || 360.0;
var lastAngle = this.options.rotation;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var radiusX = 'radiusX' in this.options ? this.options.radiusX : this.options.radius;
var radiusY = 'radiusY' in this.options ? this.options.radiusY : this.options.radius;
var keys = Object.keys(this.options.data);
Expand Down Expand Up @@ -667,7 +667,7 @@ L.RadialBarChartMarker = L.ChartMarker.extend({
var angle = this.options.rotation;
var maxDegrees = this.options.maxDegrees || 360.0;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var lastRadiusX = this.options.radiusX || this.options.radius;
var lastRadiusY = this.options.radiusY || this.options.radius;
var data = this.options.data;
Expand Down Expand Up @@ -734,12 +734,12 @@ L.StackedRegularPolygonMarker = L.ChartMarker.extend({
var lastRadiusX = 0;
var lastRadiusY = 0;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var data = this.options.data;
var chartOptions = this.options.chartOptions;
var chartOption;
var key;

var minValue, maxValue, minRadius, maxRadius;
// Iterate through the data values
var bars = [];

Expand Down Expand Up @@ -839,7 +839,7 @@ L.RadialMeterMarker = L.ChartMarker.extend({
var startAngle = this.options.rotation;
var maxDegrees = this.options.maxDegrees || 360.0;
var bar;
var options = this.options;
var options = L.Util.extend({}, this.options);
var radiusX = this.options.radiusX || this.options.radius;
var radiusY = this.options.radiusY || this.options.radius;
var data = this.options.data;
Expand Down

0 comments on commit 38b652f

Please sign in to comment.