HighChart XAxes Category - highcharts

I want to draw line graph with highchart. I have some values from database.
like : Array ( [0] => Array ( [sum] => 1820 [ay] => October ) [1] => Array ( [sum] => 3144 [ay] => November )
I have two vaues for two months(October and November)
my script is:
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
When I want to draw graph.Its looks like in picture.
Its showing January and February. How can change it by my value.

Array format make an array with just month.
foreach($data5 as $mon)
{
$zzz .="'".$mon['ay']."',";
}
and script will be:
xAxis: {
categories: [<?php echo $zzz; ?>]
},

Related

Display informations under the X-Axis like in Excel with Highcharts

I have a problem to display informations in Highcharts under the X-Axis, it should look like in the:
I tried the Function exporting.showTable but it doesnt look like i want it. Thanks for any help.
Best regards
RichieRich
From the Highcharts side, you can start from this template and add a custom HTML table under the chart.
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
tickWidth: 1,
offset: 0,
tickLength: 30
},
Demo: https://jsfiddle.net/BlackLabel/hdjto1zv/

Highcharts: Previous category data in tooltip

In this fiddle http://jsfiddle.net/c98vd98b/ is a solution for displaying a previous value in tooltip.
How can I do this please same but for ?
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
for example I want have in tooltip actual and previous month like this.
Tooltip1: "between Jan and Feb is actual value"
Tooltip2: "between Feb and Mar is actual value"
....

highcharts only one label is getting displayed

Only one label is displaying on xAxis categories.
Lable "Jan" is displaying but no other label shows up.
Chart type is: Column
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
}

Highcharts custom x-axis categories aligned center (Under the pins)

I am setting custom categories inside the x-axis, once I do that however, the x-axis labels lose their alignment (no longer under the pins)
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
This produces
but what I am after is (with the labels as 'Jan' 'Feb'..etc)
Is there a way to achieve that with custom categories?
Fiddle here: http://jsfiddle.net/7Lydc94n/
You need to set axis.tickmarkPlacement to 'on'.
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
tickmarkPlacement: 'on'
},
example: http://jsfiddle.net/7Lydc94n/3/

Set the number formatting in general for a Highcharts chart?

I've been looking all over, and testing one million things now. I just can't get it to work. I want the numbers to show up as "99 999" instead of "99,999".
Yes, I eventually found "thousandsSep", but it seems to be ignored completely. All my numbers show up as "99,999" even when I have "lang: { thousandsSep: ' ' }" and whatnot.
Please help.
thousandsSep works for me:
Highcharts.setOptions({
lang: {
thousandsSep: ' '
}
});
$('#container').highcharts({
chart: {
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
plotOptions: {
series: {
dataLabels: {
enabled : true
}
}
},
series: [{
data: [10029, 1715, 1006, 1292, 14400, 1760, 135, 1480, 10216, 1194, 1956, 1544]
}]
});
http://jsfiddle.net/FPF2t/

Resources