Git Product home page Git Product logo

Comments (6)

themustafaomar avatar themustafaomar commented on May 13, 2024

I think it would be great if you provided some code to test.

from jsvectormap.

studiosacchetti avatar studiosacchetti commented on May 13, 2024

[{"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.

themustafaomar avatar themustafaomar commented on May 13, 2024

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.

studiosacchetti avatar studiosacchetti commented on May 13, 2024

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.

themustafaomar avatar themustafaomar commented on May 13, 2024

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.

studiosacchetti avatar studiosacchetti commented on May 13, 2024

it work! thx a lot!!

from jsvectormap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.