【发布时间】:2016-10-24 13:36:59
【问题描述】:
我已经使用 javascript Amcharts 函数创建了地图。这是我的代码 -
var recentlyLegend = {"id":"recentlyLegendDiv","width":155,"maxColumns":1,"backgroundAlpha":0,"left":0,"top":350,"horizontalGap":10,"switchable":true,"switchType":"x","markerSize":16,"fontSize":10,"data": recentlyWorldLegendData};
$scope.regionByCountryGeoMap = function(chart){
var source = worldLevelProcessImages(chart.data, recentlyWorldDataProvider, recentlyLegendColorArray);
AmCharts.theme = AmCharts.themes.dark;
recentlyMap = new AmCharts.AmMap();
recentlyMap.mouseWheelZoomEnabled = true;
recentlyMap.zoomControl = {
panControlEnabled: false,
zoomControlEnabled: true,
top: 60,
left: 15,
gridHeight: 100,
iconSize:9,
gridBackgroundAlpha: 0
};
recentlyMap.responsive = {
enabled: true
};
recentlyMap.areasSettings = {color: "#D8DDDF", selectable: true, selectedColor: "#436BFF", outlineColor: "#fff", outlineThickness:
0.5};
recentlyMap.imagesSettings.balloonText = "<div align='left' style='font-size:10px;'>[[title]]</div>";
recentlyMap.imagesSettings.bringForwardOnHover = false;
recentlyMap.legend = recentlyLegend;
recentlyMap.hiddenLegendItems = {};
recentlyMap.addListener('init', function () {
recentlyMap.preventDragOut = true;
recentlyMap.legend.switchable = true;
recentlyMap.legend.addListener('clickMarker', recentlyHandleLegendClick);
recentlyMap.legend.addListener('clickLabel', recentlyHandleLegendClick);
});
recentlyMap.addListener("rendered", function () {
recentlyMap.initialZoomLatitude = recentlyMap.zoomLatitude();
recentlyMap.initialZoomLongitude = recentlyMap.zoomLongitude();
});
recentlyMap.dataProvider = source;
recentlyMap.addListener("clickMapObject", handleMapObjectClick);
recentlyMap.export = {
enabled: true,
position: "bottom-right"
};
recentlyMap.write(chart.chartId);
}
地图已正确渲染,但图例仅出现在窗口调整大小时,它也没有为图例使用自定义 css
谁能解决这个问题?
【问题讨论】:
-
您能否以小提琴的形式提供您的问题的minimal, complete, and verifiable example?我尽我所能,但你的代码对我来说很好here。
-
我的图表没有在页面重新加载时呈现。我正在使用 clink 事件在同一页面上呈现图表。这可能是面临这个问题的原因。
-
另外,在我的情况下,legends div 不采用自定义 CSS。
-
如果没有看到重现您问题的演示,就很难解决您的问题。制作一个小提琴/plunker/codepen,以便我们查看并提供建议。
标签: javascript angularjs amcharts