AnyChart / AnyChart-Android

AnyChart Android Chart is an amazing data visualization library for easily creating interactive charts in Android apps. It runs on API 19+ (Android 4.4) and features dozens of built-in chart types.
2.29k stars 369 forks source link

Mistake in map world #218

Closed CharlotteJu closed 3 years ago

CharlotteJu commented 3 years ago

Hi !

I've a problem with the map's script (World Source) : https://cdn.anychart.com/releases/8.9.0/geodata/custom/world_source/world_source.js !

Some country are not at the good place visibly ...

Like, in this example, Russia (in gray) or France (in purple). I don't understand, because in this link, that looks great !

Screenshot_20210409-145654_Gif Itch

In my code, I just do :

val url = "https://cdn.anychart.com/releases/8.9.0/geodata/custom/world_source/world_source.js" mView.anyChartViewCountry.addScript(url)

Can you tell me if the error is only on my side ?

Thanks !

Shestac92 commented 3 years ago

@CharlotteJu Make sure that you have added the library for geo calculations:

anyChartView.addScript("file:///android_asset/proj4.js");

The library is available by the link.

CharlotteJu commented 3 years ago

@CharlotteJu Make sure that you have added the library for geo calculations:

anyChartView.addScript("file:///android_asset/proj4.js");

The library is available by the link.

Hi @Shestac92 I've add it, but nothing has changed ...

val urlWorld = "https://cdn.anychart.com/releases/8.9.0/geodata/custom/world_source/world_source.js" val urlProJS = "https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js"
mView.anyChartViewCountry.addScript(urlWorld) mView.anyChartViewCountry.addScript(urlProJS)

CharlotteJu commented 3 years ago

I think I understood the problem, but I don't know how to fix it ...

In my exemple, France and Russia have many territories in the world, and the bubble get in the middle.

(France light blue, Russia dark blue)

image

Does anyone know how to put the bubble in a specific location?

Shestac92 commented 3 years ago

@CharlotteJu Got it! I thought you were using geo-coordinates for markers... Yes, some countries have separated territories. If you are using country ID for placing markers, then the markers is placed in the geometry center of the whole country territory.

In this case, we recommend using geo-coordinates for markers. For details, check the snippet.

CharlotteJu commented 3 years ago

Thanks a lot, it's good !!