Remove [Object] label in highchart - javascript

I'm a newbie in highchart and not familiar with advance javascript functions and I have created a chart with custom x-axis value. Everything works fine but there's a label that annoyed me. There is an [object Object] label in a chart.

See if this helps you
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
title: {
text: ''
},
},
You can change the x-Axis label and also leave it blank if you want it empty.
See the following link for a working example
Highcharts - basic line chart
If any specific help is required please share your src code with us.

The chart looks like this:
100 |
90 |
80 |
70 |
60 |
50 |
40 |
30 |
20 |
10 |
0 -------------------------------------------------------------
[Object 1:00 2:00 3:00 4:00 5:00
Object]

Related

Remove first and last grid lines in highcharts?

I want to separate the points on a line graph by vertical lines in Highcharts. I can do this with grid lines, but I would like the lines to display only between points and not before the first point and after the last one. In the fiddle there should be no grid lines before 'Jan' and after 'Dec'. Is it possible?
Here is my x-axis
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
gridLineWidth: 1,
minorGridLineWidth: 0
}
Just delete two last <path> elements in the group <g> element .
Example on fiddle
Axis has classname attribute.
set an axis classname.
set CSS to hide the last path element.
.axis-container {
path:last-child {
display: none;
}
}

How to create Jquery month select calender

I want a jquery month select calender. can anyone give me a website link or steps how to create month view calender like this image. please help me
Fiddle : Enjoy this : http://jsfiddle.net/abdennour/pyS99/
options = {
pattern: 'yyyy-mm', // Default is 'mm/yyyy' and separator char is not mandatory
selectedYear: 2010,
startYear: 2008,
finalYear: 2012,
monthNames: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez']
};
$('#custom_widget').monthpicker(options);
Source :
http://lucianocosta.info/jquery.mtz.monthpicker/

Display 'Full-month-name yyyy' with eyecon bootstrap datepicker

I'm trying to display full month name like 'January 2014' with eyecon Bootstrap datepicker http://www.eyecon.ro/bootstrap-datepicker/ Does anybody know if it's possible? I've tried everything I know (I'm a junior in JS).
I know this is little old thread. But I came across this when I was searching for similar behavior. As I couldn't find such feature natively, patched some code snippets to get that work.
http://jsfiddle.net/saz52h11/
The changes are:
var monthnames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
----
case 'mmm':
date.setMonth(monthnames.indexOf(val));
----
mmm:monthnames[date.getMonth()]
----
val.mmm = monthnames[val.m-1];
Hope this helps
This works fine:
$("#datepicker").datepicker( {
format: "MMMM YYYY",
startView: 1,
minViewMode: 1
});
Change the format field to 'MMMM' instead of 'mm' and it will provide full month. If you use "MMM" it will show the three character abreviation for the month.
You can try this:
$("#datepicker").datepicker( {
format: "mm-yyyy",
viewMode: "months",
minViewMode: "months"
});
also notice that in the version of 1.2.0 the viewMode has changed to startView.
Update:
Refer This Demo

Highcharts min y-axis value

Is it possible to set a min y-axis value when the series values are the same?
For example:
http://jsfiddle.net/6hyfk/1/
I would like to see 0.00019 as y-axis value.
If i change it to:
series: [{
data: [0.00019,0.00020,0.00019,0.00019]
}]
it looks a lot better.
So the answer largely depends on your data. If for example, you know your values are all positive, setting a yAxis min helps your data display a bit better. You know your data better than I, so I'd look at the yAxis settings and see what you can change to get a better result, but for example, this is a JSFiddle that sets a minimum value:
$(function () {
$('#container').highcharts({
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
tickLength: 20
},
yAxis: {
min: 0
},
series: [{
data: [0.00019,0.00019,0.00019,0.00019]
}]
});
});
http://jsfiddle.net/gTG2z/
You can manually set the min and max on the X axis.
yAxis:{
min: 0,
max: .001
},
http://jsfiddle.net/6hyfk/2/
If you know what range is in your series, you can set accordingly minRange, so Highcharts will render more ticks as expected. For example: http://jsfiddle.net/Fusher/6hyfk/3/ Good thing about minRange is that it will work also for another values like that: http://jsfiddle.net/Fusher/6hyfk/5/
Probably,you don't need to hardcode min,max values.Do calculation for min and max and set to y Axis as shown below,
$(function () {
yMin = Math.min.apply(Math,data); // Find Min
yMax = Math.max.apply(Math,data); //Find Max
$('#container').highcharts({
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
},
yAxis: {
min: yMin,
max: yMax
},
series: [{
data: data //Array of values
}]
});
});

highchart: add images to top of chart on every column

Does anyone know if it's possible to create something like this in Highcharts:
It's about the weather icons on the top. I added them as a "scatter graph" which is nice, so the images/graph can be disabled. But I want them always at the top. For example: y=20px or something. Is it possible to do this with Highchart? I know set their data to "30 celcius" but that would mess up the graph if it the temperature would go up to 30 degrees.
You can use a trick of having two x-axes, one with images and offset'ed to the top of the chart and one with the usual labels at the bottom:
xAxis: [{
offset: -290,
tickWidth: 0,
lineWidth: 0,
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
labels: {
x: 5,
useHTML: true,
formatter: function () {
return '<img src="http://highcharts.com/demo/gfx/sun.png"><img> ';
}
}
}, {
linkedTo: 0,
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
}],
Full example on jsfiddle
I found a solution by chance because of a logging code I forgot to remove. You can access the data inside the method formatter using "this":
...
plotOptions: {
series: {
dataLabels: {
useHTML: true,
enabled: true,
x: -50,
y: -50,
formatter: function(){
console.log(this);
return '<span>'+this.y+'</span><br/>'+this.series+'<img src="'+this.key+'" />';
},
}
...
This code surely isn't working, but shows up the idea, doesn't it?
Hope it helps!
Given that highcharts is just SVG you can always go directly and manipulate the SVG to show the images you want, usually with just CSS. You can inspect the chart with Chrome's web inspector and find the elements you want to style. I have to warn you though that having customized highcharts myself in the past has made upgrading to newer versions difficult.
You can add another scatter plot to your series that contains specific markers: http://jsfiddle.net/ZZ7Kd/135/
You can use Renderer.image() to add images in any place on chart
http://api.highcharts.com/highcharts#Renderer.image()

Categories