2
I did this simulation (jsfiddle also):
$(function() {
$.ajax({
url: "https://www.json-generator.com/api/json/get/cqueInyKdK?indent=2",
type: 'POST'
}).done(function(makeTheDO) {
console.log(makeTheDO);
//datas que quero no eixo X
console.log(makeTheDO[0].data);
//series que quero no eixo Y
console.log(makeTheDO[0].serie);
// Create the chart
Highcharts.stockChart('container', {
rangeSelector: {
selected: 1
},
yAxis: {
category: makeTheDO[0].data
},
series: [{
name: 'ponto no periodo da data que nao consigo por',
data: makeTheDO[0].serie,
tooltip: {
valueDecimals: 1
}
}]
});
});
});
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>
<h3>Como usar datas do BD em um json no highcharts Eixo X?</h3>
<div id="container" style="height: 400px; min-width: 310px"></div>
But this json is being mounted in my database through PHP, this date comes from the database, and I’m not able to put it on eixoX, someone can help me?
was not working because there is no way to put HTTP inside an HTTPS site without affecting security, I changed the link
http://www.json-generator.com/api/
forhttps://www.json-generator.com/api/
(I switched to HTTPS)– Guilherme Nascimento
Tried to
xAxis
? I’m not sure I understand your problem– Guilherme Nascimento
@Guilhermenascimento in my code I tried Category: makeTheDO[0]. date, for on the axis Xaxis he put 1 Jan.. etc, but does not appear in the x axis, as you can see in the graphic img
– Julio Henrique
Your JSON is misspelled when passed to the axes, see the examples https://www.highcharts.com/docs/chart-concepts/axes
– Guilherme Nascimento