var chart;
AmCharts.ready(function() {
var chartData = AmCharts.loadJSON(1,3600);
// SERIAL CHART
var chart = AmCharts.makeChart("chartdiv", {
"type": "serial",
"theme": "none",
"valueAxes": [{
"position": "left"
}],
"graphs": [{
"id": "g1",
"proCandlesticks":true,
"balloonText": "Open:<b>[[open]]</b><br>Low:<b>[[low]]</b><br>High:<b>[[high]]</b><br>Close:<b>[[close]]</b><br>",
"closeField": "close",
"fillColors": "#7f8da9",
"highField": "high",
"lineColor": "#7f8da9",
"lineAlpha": 1,
"lowField": "low",
"fillAlphas": 0.9,
"negativeFillColors": "#db4c3c",
"negativeLineColor": "#db4c3c",
"openField": "open",
"title": "Price:",
"type": "candlestick",
"valueField": "close"
}],
"chartCursor": {
"valueLineEnabled":true,
"valueLineBalloonEnabled":true
},
"categoryField": "date",
"categoryAxis": {
"parseDates": true,
"minPeriod":"ss",
"dashLength": 5,
"minorGridEnabled":true,
"minorGridAlpha":1
},
"dataProvider": chartData
});
chart.dataDateFormat = "YYYY-MM-DD JJ:NN:SS";
chart.add
chart.addListener("rendered", zoomChart);
chart.validateData();
chart.validateNow();
zoomChart();
setInterval(UpdateChart,20000);
function generateChartData() {
$.ajax({
type: "GET",
url: "../Modules/quotes_writer_clear.php",
success: function(d){ var obj = jQuery.parseJSON(d);
var firstDate = new Date(obj.date*1000);
firstDate.setDate(firstDate.getDate() - 10);
chartData.push({
"date": firstDate,
"open": obj.open,
"high": obj.high,
"low" : obj.min,
"close": obj.close});
}
});
chart.validateData();
chart.validateNow();
}
function UpdateChart()
{
generateChartData();
}
function zoomChart() {
chart.zoomToIndexes(chart.dataProvider.length - 50, chart.dataProvider.length - 1);
}
});
AmCharts.loadJSON = function(v,p) {
var Request_result;
$.ajax({ type: "GET",
url:"../Modules/init.php",
data: "valpair="+v+"&period="+p,
success: function (result)
{
Request_result=result;
}
});
return JSON.parse(Request_result);
};
Ошибка есть, в консоли указывает на 1-ю строку когда я по ней перехожу она оказывается пустая и с ошибкой Unexpected token u