Comments (6)
I think it would be great if you provided some code to test.
from jsvectormap.
[{"id":"1","state":"1","name":"aaaa usa","contact":"pippo","address":"via roma","description":"","image":"","website":"","email":"","fax":"","tel":"","longitude":"-71.043281","latitude":"42.3727575","city":"boston","post_code":"","country":"United States of America","areas_name":"north America","countries":"CA,US"},{"id":"2","state":"1","name":"est europe","contact":"pippo","address":"via roma","description":"","image":"images\/vdm\/jcb500.jpg","website":"","email":"","fax":"","tel":"","longitude":"20.7810167","latitude":"52.2326063","city":"boston","post_code":"","country":"Poland","areas_name":"est europe","countries":"CZ,HK,PO"}];
var config = <?php echo json_encode($config); ?>;
var items = <?php echo json_encode($this->items); ?>;
var dealers = items.map(item => ({
name: item.name,
coords: [item.latitude, item.longitude],
row1: item.contact + ': ' + item.address + ' , ' + item.city,
row2: item.tel + ' / ' + item.fax,
row3: item.email + ' / ' + item.website,
countries: item.countries.slice(0,item.countries.indexOf("\n")).split(",")
//image:item.image
}));
dealers.push({
name: config.page_description,
coords: [config.latitude, config.longitude],
row1: config.marker_name,
row2: config.marker_description,
countries: ['IT'],
style: {
image:config.pin
}
//image: config.logo
});
var map = new jsVectorMap({
map: 'world',
selector: '#mapid',
onLoaded(map) {
map.container.delegate(
"circle.jvm-marker, text.jvm-marker",
"mouseout",
(e) => {
if (e.type === "mouseout") {
map.clearSelectedRegions();
}
}
);
},
labels: {
markers: {
render: function (dealers) {
return dealers.name; // + dealers[index].coords ;
}
}
},
markerStyle: {
initial: {
fill: config.primary_color,
r: 7,
strokeWidth: 5
},
selected: {
fill: config.secondary_color
}
},
markerLabelStyle: {
initial: {
// It would be nice if you change this font
fontFamily: 'Sans-serif',
fontSize: 13.5,
fontWeight: 500,
fill: '#35373e'
}
},
regionStyle: {
// Everything in initial property can be overwritten here
selected: {fill: config.secondary_color}
},
markers: dealers,
series: {
regions: [
{
attribute: 'fill',
scale: {
primarycolor: config.primary_color
},
values: {[config.main_country]: 'primarycolor'}
//values: {'IT': 'primarycolor'}
}
]
},
onMarkerTooltipShow: function (tooltip, index) {
tooltip.selector.innerHTML ='<h3>' + dealers[index].name + '</h3>'
+ '<ul><li>'+ dealers[index].row1 +'</li>'
+ '<li>'+ dealers[index].row2 +'</li>'
+ '<li>'+dealers[index].row3 +'</li></ul>';
map.setSelected('regions', dealers[index].countries);
}
});
document.querySelector('#focus').addEventListener('click', () => {
map.setFocus({
region: config.main_country,
animate: true
});
});
from jsvectormap.
WTH!
Please show what dealers
object is, or console log it and copy that object and send it.
Why you're sending all of that, and there are missing codes in php.
Again, please send the markers object in plain JavaScript so I can test it
from jsvectormap.
hello
marker object was in the top of the previous post, i do
var items = [ { "id": "1", "state": "1", "name": "aaaa usa", "contact": "pippo", "address": "via roma", "description": "", "image": "", "website": "", "email": "", "fax": "", "tel": "", "longitude": "-71.043281", "latitude": "42.3727575", "city": "boston", "post_code": "", "country": "United States of America", "areas_name": "north America", "countries": "CA,US" }, { "id": "2", "state": "1", "name": "est europe", "contact": "pippo", "address": "via roma", "description": "", "image": "images/vdm/jcb500.jpg", "website": "", "email": "", "fax": "", "tel": "", "longitude": "20.7810167", "latitude": "52.2326063", "city": "boston", "post_code": "", "country": "Poland", "areas_name": "est europe", "countries": "CZ,HK,PO" } ]
i did not post php because there was no problem in the version prior to 1.3 so assumed issue was relatetd to last release
from jsvectormap.
Well, the latitude
and longitude
are no longer exist instead there is a coords
array which accecpts
the latitude
as the first item and longitude
as the second.
Take a look at docs:
https://themustafaomar.com/open-source/jsvectormap/docs/markers/
Here is the fix for your issue:
https://codepen.io/themustafaomar/pen/yLXGjwB
from jsvectormap.
it work! thx a lot!!
from jsvectormap.
Related Issues (20)
- MultiMap constructor HOT 1
- support for interactions like region hover or marker hover HOT 1
- Can't load United States map HOT 2
- TypeError: Cannot read properties of undefined (reading 'text') HOT 1
- Touch support is lacking HOT 3
- Error when deploying to Vercel
- map is not scaling to the container width HOT 2
- draggable being false is not respected for mobile touch events HOT 1
- AddMarkers raise exception HOT 3
- Error when dragging in mobile HOT 5
- Dynamic resize HOT 1
- Error when dragging in mobile HOT 1
- Focus not working on US. HOT 2
- Error when running the map HOT 2
- Support for add/remove Regions individually? HOT 5
- Default fill on region click HOT 1
- fix a typo [in tooltip page] HOT 1
- QUESTION: tool bar button color change ? HOT 3
- [Enhancement] Arrow in line HOT 1
- Could you please extend your library to use it in ShadowDOM? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsvectormap.