Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Novas funcionalidades do plugin #3

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
40 changes: 32 additions & 8 deletions GMapComponentAsyncLoader.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v. 2.0.
If a copy of the MPL was not distributed
with this file, You can obtain one at
http://mozilla.org/MPL/2.0/.
/*!
* JavaScript - loadGoogleMaps( version, apiKey, language )
*
* - Load Google Maps API using jQuery Deferred.
* Useful if you want to only load the Google Maps API on-demand.
* - Requires jQuery 1.5
*
* Copyright (c) 2011 Glenn Baker
* Dual licensed under the MIT and GPL licenses.
*
* The MIT License (MIT)
* Copyright (c) 2011 Glenn Baker
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:

* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.

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

var loadGoogleMapsOverlay = (function($) {

var now = $.now(), promise;
Expand Down Expand Up @@ -85,7 +109,7 @@ var loadGoogleMapsOverlay = (function($) {
$.ajax({
dataType: 'script',
data: params,
url: 'http://maps.googleapis.com/maps/api/js'
url: "http://maps.googleapis.com/maps/api/js"
});

}
Expand All @@ -96,4 +120,4 @@ var loadGoogleMapsOverlay = (function($) {

};

} (jQuery));
} (jQuery));
114 changes: 112 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,123 @@ GMaps Version 1.x tested on Pentaho 4.5 / 4.8<br>
<br>
<h1>Sample</h1>

<a href='https://sourceforge.net/projects/pentahogmapsoverlay/files/'>https://sourceforge.net/projects/pentahogmapsoverlay/files/</a>
[How to use this plugin](https://sourceforge.net/projects/pentahogmapsoverlay/files/ "How to use this plugin")

<h1>Usage</h1>

See the video for GMapsOverlay Version 1.0.0<br>
<a href='http://youtu.be/oyppms5fGhc'>http://youtu.be/oyppms5fGhc</a>

[Plugin video usage](http://youtu.be/oyppms5fGhc "Plugin video usage")

<h1>Adding New Maps</h1>

For new maps just create a new definition map and save it in the pentaho-solutions/cde/components/gmapsoverlay/map-def folder.

<h1> New plugin features </h1>

- **DoubleClickAction**
- You can specify a function with two parameters for you to call another action based on the value of the shape that received double click

function(obj,e){
if(regiao_mapa !== '[Municipio].[MunicipioX]'){
Dashboards.fireChange('regiao_selecionada_mapa', obj.infowindow.dataPayload.name);
}
}

- **DisableDoubleClickZoom**: true | false
Option to disable the zoom in the double click because it interferes if you will use the DoubleClickAction

- **LabelsIcons**: On | Off
Show icons on the map

- **AdministrativeLocality**: On | Off
Show location information

- **MapColorConditional**
You can define a function that receives a parameter and based on the value of this parameter returns a color in the format #000000.<br>
Obs: The isColorDefinedInDS property must be false for use of this function.

function(value){
if(value > 20){
return '#00FF00'
}
}

- **MapNameConditional**
Here you define a function that returns the file name of the shape that will be drawn on the map depending on a certain condition


function(){

if (regiao_mapa == '[MunicipioResidencia].[MunicipioX]') {
return 'goias-municipios';
} else if (regiao_mapa == '[RegiaoSaude].[RegiaoSaudeX]') {
return 'goias-regiao-saude';
} else if (regiao_mapa == '[MacroRegiao].[MacroRegiaoX]') {
return 'goias-macro';
} else if (regiao_mapa == '[RideRegiao].[RIDEX]') {
return 'goias-ride';

}
}

- **ScrollWhell**
Enables or disables scroll zoom
- **ShapeFillOpacity**
Here you define the transparency of shape
- **shapeStrokeWeight**
Define a shape line thickness
- **ValueFormat**
Here you define a function that receives a value parameter where you will format the value and return the formatted value.

function(value){
return accounting.toFixed(value, 2)+"%";

}

- **ZoomControl**
Enable / disable zoom control
- **isColorDefinedInDS**: true | false
If this option is ** true ** it is mandatory to bring the color (in the format: # 00FF00) in the third column of your datasource
- **LegendItemLabelDescConditional**
Here you define a function that returns an array with the description of the legend item

function (){
if ( MENU_SELECIONADO == PRE_NATAL) {
return ['≥75.01%','≥ 50.01% e ≤75%','≤ 50%','0%'];
}else if(MENU_SELECIONADO == MAES_ADOLESCENTES){
return ['≥0.01% e ≤15%','≥ 15.01% e ≤25%','≥ 25.01%','0%'];
}
}

- **LegendItemLabelDescFonteColor**
 Color description of the item in the legend. Here you write the color ex: 'white'
- **LegendItemLabelDescFonteSize**
Legend item font size
- **LegendOpacity**
 Legend Transparency
- **LegendPosition**
 Position Legend
- **LegendItemCountVisible**
Show a counter of the legend colors that are in shape
- **ExportToCSVFileVisible**
 Enable / disable option in subtitle to export map data to csv

#### Sample: ####

- **Dashboards that use this plugin**

- [Dashbord SINASC](https://extranet.saude.go.gov.br/public/genesis.html "Dashbord SINASC")
- [Dashbord SIM](https://extranet.saude.go.gov.br/public/sim.html "Dashbord SIM")
- [Dashbord DENGUE](https://extranet.saude.go.gov.br/public/dengue.html "Dashbord DENGUE")

- **Map by municipality**

![MAPA_MUNICIPIOS]( http://fs5.directupload.net/images/170630/9bfwicpi.png )


- **Map by Health Region**

![MAPA_REGIAO SAUDE]( http://fs5.directupload.net/images/170629/gzhinikv.png )


Loading