How to show tooltip data below each column in Highchart? - highcharts

The tooltip data in highchart is visible when i hover my mouse over it, the tooltip has some data that i want to show for example below the column where the x label is, for now it shows 0,1,2 and so on.
I am using the chart to compare timeperiods, so under each column i want to add data from the tooltip. It could be 2 dates I compare below each column, a picture would be helpful for you but i am not a trusted stackoverflow user yet.

An example using a datetime xAxis type:
Fiddle:
http://jsfiddle.net/jlbriggs/1bs6vL3t/
Code:
In the xAxis properties, specify the type as datetime:
xAxis: {
type: 'datetime'
},
In the series, specify your x values as dates (using either the Date.UTC() method, or by directly specifing epoch time)
series: [{
data: [
[Date.UTC(2016, 05, 6), 3],
[Date.UTC(2016, 05, 13), 5],
[Date.UTC(2016, 05, 20), 4],
[Date.UTC(2016, 05, 27), 7],
[Date.UTC(2016, 06, 4), 6],
[Date.UTC(2016, 06, 11), 9],
[Date.UTC(2016, 06, 18), 7],
[Date.UTC(2016, 06, 25), 5]
]
}]
Output:
And, an alternative version that uses categories instead:
http://jsfiddle.net/jlbriggs/1bs6vL3t/2/
Generally, when working with time series data, using datetime is preferable. There may be cases where various circumstances make it less effective, in which case categories can be a useful alternative.
{{ Edit }}
After re-reading your comments, here's another version, using categories, that might be more like what you're looking for:
http://jsfiddle.net/jlbriggs/1bs6vL3t/5/
This may also be a case for the Grouped Categories plugin:
http://www.highcharts.com/plugin-registry/single/11/Grouped-Categories

Related

Highcharts: change timeUnit thresholds

I'm looking a way to override Highcharts.timeUnits, which seems the array defining when jump from a unit to another unit. (It's not as simple as that in the source code, but ...)
Why ? Because my need is the following :
I have timeserie data, by 15 minutes, for 3 years.
I want a zoomable column chart (I use highstock in practice), where I have 1 column by month with a given zoom, 1 column by week when I zoom more, then 1 by day, 1 by hour and then 1 by 15min
In the idea, I use plotOptions.series.dataGrouping.units to define these parameters:
units: [
[
'minute',
[15]
], [
'day',
[1]
], [
'week',
[1]
], [
'month',
[1]
], [
'year',
[1]
]
],
But Highcharts use its own rules to jump from an unit to another one, and I find these rules not appropriated to my use-case (switch is too "early", I think)
I can change a bit the behaviour by modifying groupPixelWidth but this is a last resort, because it behaves strangely anyway.
Here is an example. If you click on the various time scales, you'll see that the the timeUnit choosen are often not appropriated.
For example choosing week or with a span from Nov 5, 2018 to Nov 26 2018 : you get data displayed by hour, but data by would be more readable, etc.
https://jsfiddle.net/f4wma38h/
so you are looking for 15 minutes & hour zooming in your chart am i right?
xAxis: {
type: 'datetime',
minRange: 15 * 60 * 1000
},
rangeSelector: {
buttons: [{
type: 'minute',
count: 15,
text: '15m'
}, {
type: 'minute',
count: 60,
text: '1h'
},.....
make the xrange minvalue as 15 in milliseconds & in range selector add the button for 15m & 1h
jsfiddle:https://jsfiddle.net/karnan796/f4wma38h/11/

Highcharts Progress bar with % values and Y axis to be as Date values

I'm new to High Charts and working on an example with the Data on the Y-axis as Date component with the Start and End Dates and the X Axis will be of type with the 'Bar' chart
Here is the link of my example jsfiddle
The series data would be something like this
'series: [{
name: '',
low: Date.UTC(2016, 07, 01),
high: Date.UTC(2017, 04, 04)
}'
Any helps on this would be highly appreciated
Updated on 03/04/2017 for the Image attachment
Here the bars going beyond the End Date time

Highcharts breaks on axis

I have a few years of sample data that I'd like to break at year end (12/31) of every year. Trying to implement this code from example from API
breaks: [{ // break on last day of year
from: Date.UTC(2008, 12, 31, 58),
to: Date.UTC(2008, 12, 31, 59),
repeat: 24 * 36e5 // not sure how to use this
}],
is there a way to ignore the year in Date.UTC()? Also I'd like to repeat this every year. Tied numerous combos to no avail. Heres my jsfiddle
Adding null value point will create a gap in a series plot if connectNulls is set to false (by default it is false).
Example: http://jsfiddle.net/c9e9ao2L/1/

Don't display not present date values

I'm trying to get Highcharts to display the daily usage statistics for e.g. a company's ressource. The opening days of the company are from monday to friday.
My dataseries look like this:
[Date.UTC(2012, 8, 6),17.5], (Thu)
[Date.UTC(2012, 8, 7),42.5], (Fri)
-- weekend
[Date.UTC(2012, 8, 10),20], (Mon)
[Date.UTC(2012, 8, 11),20], (Tue)
[Date.UTC(2012, 8, 12),40], (Wed)
[Date.UTC(2012, 8, 13),30], (Thu)
...
In the time series chart there are inserted two labels for the missing two weekend-dates (2012, 8, 8 and 2012, 8, 9), but I don't want those labels to be displayed because there are no values for these labels and so the adjacent dates will be connected via a line but this is wrong.
Is it possible to turn off this 'date interpolation' and show only the values I've inserted?
Thanks with regards, Phil
It may be possible using a scatter series and customizing the tickPositioner callback for the x-axis and filtering of x series data (dates) thats not a weekday.
I've created a fiddle at http://jsfiddle.net/hkskoglund/6jNGg/
To allow for missing weekends days null should be pushed for the y-value in the series data (as mentioned in comment above)
Another option without using a datetime axis is to use a category axis where you push the dates in the series you have data for. This will allow to have a continous plot. Take a look at the new fiddle: Areaspline with categories as dates
xAxis: {
labels: {
formatter: function() {
// http://api.highcharts.com/highcharts#Highcharts.dateFormat()
return Highcharts.dateFormat('%d %b', this.value);
}
},
categories : [
Date.UTC(2012, 8, 6),Date.UTC(2012, 8, 7),
Date.UTC(2012, 8, 10),Date.UTC(2012, 8, 11),
Date.UTC(2012, 8, 11)]
},
series: [{
name : 'resources',
data: [17.5,42.5,20,25,20]
}]
As far as I can understand using datetime on the x-axis using your requested plot-configuration is not possible without changing the source/rendering of Highcharts series. It seems like discontinuties with null values is separated into socalled segments.
Have you tried to set oridinal as false?
http://api.highcharts.com/highstock#xAxis.ordinal
I know this is an old question, but did you try formatting your dates as Strings before inserting them? If so, you can then use a category axis. This should work as long as you don't have any entry for date vs having a null.
I use Highcharts embedded in JasperReports, but this allows us to get your desired behavior.

How to set xaxis label according my json result data?

Hi. I have this json result:
([{"total": 2797, "date": "13.12"}, {"total": 3252, "date": "14.12"}, {"total": 771, "date": "15.12"}, {"total": 669, "date": "16.12"}, {"total": 2962, "date": "17.12"}, {"total": 1, "date": "19.12"}])
I want set the date value on my xaxis label, but I'm not able to do that.
Help?
Thanks!
If all series points are going to be one-day increments and you want the xAxis date format to be day.Month you can do the following using the Date.UTC method:
Date.UTC(year,month,day,hours,minutes,seconds,millisec)
The year, month, and day are all required. So you will need to get that value as well. Note that months start at 0 and go to 11.
Then your data, in HighCharts format, would look like:
[Date.UTC(2012, 11, 13), 2797], [Date.UTC(2012, 11, 14), 3252], [Date.UTC(2012, 11, 15), 771], [Date.UTC(2012, 11, 16), 669], [Date.UTC(2012, 11, 17), 2962], [Date.UTC(2012, 11, 18), null], [Date.UTC(2012, 11, 19), 1]
To get your chart to plot cleanly you will also need to set a value for 12.18 which your currently do not do. I set it to null. This chart will not draw a line between null points but you can have it do so with connectNulls. Set it to true if you want to connect the nulls. It is set to false by default.
Now you want to format your xAxis to display dates like '13.12'. You do this with the formatter properties. To get your format use '%d.%m'. The date format options are listed here.
How you get your data into the HighCharts format depends on your source. There are multiple ways.
Demo

Resources