【发布时间】:2018-09-06 18:50:01
【问题描述】:
我有一个 AmCharts 工作,这是代码:
var chart = AmCharts.makeChart("chartdiv", {
"type": "serial",
"theme": "light",
"precision":"3",
"decimalSeparator": ",",
"thousandsSeparator": ".",
"legend": {
"horizontalGap": 10,
"maxColumns": 3,
"position": "top",
"useGraphSettings": false,
"markerSize": 10,
"marginTop": 20,
"autoMargins":true,
"forceWidth":true,
"valueAlign":"right",
"labelWidth":85,
"valueWidth":85
},
"dataProvider": response,
"synchronizeGrid":true,
"valueAxes": [{
"axisAlpha": 0,
"position": "left",
"title": "Activos"
}],
/*"startDuration": 0.5,*/
"graphs": graphs,
"chartScrollbar": {},
"chartCursor": {
"cursorPosition": "mouse"
},
"categoryField": "diahora",
"categoryAxis": {
/*"parseDates": true,*/
"gridPosition": "start",
"axisColor": "#DADADA",
/*"minorGridEnabled": true*/
},
"export": {
"enabled": true,
"position": "top-right",
"class": "export-main",
"menu": [ {
"title": "Exportar el gráfico a archivo de imagen",
"label": "Descargar",
"menu": [ "PNG", "JPG", "PDF" ]
}]
}
});
我用 ajax 调用它:
$.get(url, function(response){
所以,我需要获取缩放后在浏览器上呈现的图形 X 范围的 2 个值,知道吗?
例如,当图表开始时,x 轴的范围是 0 和 100。如果我放大某个范围,例如 40 和 60,我需要检索这些值(40 和 60),因为我将使用他们在页面中的其他东西。
那么,如何在每次 ajax 调用后保存这些范围?
【问题讨论】:
标签: javascript amcharts