Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

lukasender
Copy link

Hey there!

I've worked a little with your project. Works great and I like it :D
Though, I was missing to from groups of markers, allowing different colouring for each group.

Here is my proposed solution:

  • It allows to specify groups,
  • and each group can have their own marker colour and size (I'm not sure if I've missed some other settings).
  • If a group does not have set specific settings, the default ones will be taken.

The other methods to add markers still seem to work as before (as one can see when opening the 'index.html').

I've also tried to update the docs as good as possible, but you might want to double check on that :)
marker-groups

(Bear in mind: I'm not a JavaScript developer, so I'm not entirely sure if I've used some nasty hacks.)

@mikefowler
Copy link
Owner

@Lumannnn, thanks for starting the conversation! This functionality was definitely on my radar, and definitely useful. I'll have a look soon as what you wrote, and might refactor your patch if I decide to pull it in.

@lukasender
Copy link
Author

@mikefowler thanks for the fast response. Refactor as you want :)
Also, I'm not sure if it is the best solution to let a user specify groups. It is rather quick and dirty and I haven't put to much thoughts into it. Maybe there is a better way.

@mikefowler
Copy link
Owner

Hey @Lumannnn, what if you could pass additional options with each marker. Not groups, per se, but with this method there might be less setup. Does this achieve the same result, in your opinion?

$('.map').smallworld({
  center: [45, -50],
  markers: [
    {
      at: [37, -122],
      markerColor: 'red'
    },
    {
      at: [42, -100],
      markerColor: '#b4da44',
      markerSize: 4
    }
  ]
});

@lukasender
Copy link
Author

Hey @mikefowler :) Thanks for the follow up.
If I understand you correctly, it'll allow you to only specify one "point" for each marker, is that correct?
Imho, that would only be less setup if you wanted to have few markers (or many markers with different properties).
I haven't played too much with that around, but I think my solution would fit my use case better.
I'd like to have, say, 100 markers in blue, and 25 markers in red, 50 in orange, and so on (maybe even opacity would make sense to indicate a different "density"?).

How would I specify that with your solution?

@mikefowler
Copy link
Owner

Ah, OK. I see your point, @Lumannnn. I like that strategy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants