I'm using jqplot in my website using the following code
$(document).ready(function(){
var xticks = [ '0', '1', '2', '3', '4','5', '6', '7', '8', '9', '10','11', '13','14','15','16','17','18','19','20','21','22','23'];
var data1 = [2,4,6,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,6,3,1,2,2,0,0,0,0,0,0,2,5,6,6,7,6,6,6,5,7,7,6,1,0,0,0,0];
var plot2 = jQuery.jqplot ('chart1', [data1],
{
animate : true,
// Will animate plot on calls to plot1.replot({resetAxes:true})
animateReplot : true,
seriesDefaults : {
pointLabels : {
show : true,
hideZeros : true,
location : 's',
ypadding : 12
},
renderer : $.jqplot.BarRenderer,
rendererOptions : {
varyBarColor : true,
barPadding : -20
}
},
axes : {
xaxis : {
label : 'X axis',
fontFamily : 'OpenSans-Regular',
textColor : '#414141',
renderer : $.jqplot.CategoryAxisRenderer,
labelRenderer : $.jqplot.CanvasAxisLabelRenderer,
tickRenderer : $.jqplot.CanvasAxisTickRenderer,
ticks : xticks,
tickOptions : {
fontFamily : 'OpenSans-Regular',
textColor : '#414141',
angle : -90,
fontSize : '10pt'
}
},
yaxis : {
min : 0,
//max : 30,
tickInterval:5,
label : 'Y axis',
fontFamily : 'OpenSans-Regular',
textColor : '#414141',
// labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
tickOptions : {
fontFamily : 'OpenSans-Regular',
textColor : '#414141',
formatString : '%.2f',
fontSize : '10pt'
}
}
},
cursor : {
show : true,
zoom : false,
showTooltip : true,
followMouse : true,
useAxesFormatters : true
/*
* To show both x and y values showTooltipDataPosition :true,
* showVerticalLine:true, useAxesFormatters:true
*/
},
legend : {
renderer : $.jqplot.EnhancedLegendRenderer,
show : true,
showSwatches : true,
fontFamily : 'OpenSans-Regular',
marginTop : '100px',
textColor : '#414141',
rowSpacing : '14px',
border : 'none',
background : 'transparent',
placement : 'outsideGrid'
},
grid : {
background : 'transparent',
gridLineColor : '#c5c5c5'
},
seriesColors : [ '#F6BD0F' ],
series : [ {
seriesColors : [ "#D85252" ],
//label : 's1',
color : [ '#D85252' ]
}, {
seriesColors : [ "#F6BD0F" ],
label : 's2',
color : [ '#F6BD0F' ]
} ],
highlighter : {
show : false
}
}
);
});
It works fine in Firefox and IE9 without any issues as in figure1. But in IE8 it looks very bad as in figure2.
I have included excanvas.js as follows
<script type="text/javascript" language="javascript" src="jQuery/jQplot/excanvas.min.js"></script>
IE9 and Firefox
IE8
Here is the working jsfiddle
Can anyone tell me how can I resolve this issue? What I'm doing wrong here? Any help will be appreciated..
Finally I got the answer after research for a day
The issue was with the background property used in jqplot options.
grid : {
background : 'transparent',
gridLineColor : '#c5c5c5'
}
I fixed it by replacing 'transparent' using 'rgba(255, 255, 255, 0.1)' in my code and it is working in all browsers including IE8. The same thing can be achieved by using background:url('blank.gif')
I got help from the following links
Highcharts chart option backgroundColor:'transparent' showing black on IE 8
IE CSS bug background color transparent behaves differently to background-color
Related
Somehow the gap is not reduced, as shown in the picture below:
I am using a Highcharts Heatmap. Please help me to reduce the gap between the intervals and the line should be closer. When we increase the data, some data is not showing on the graph and they are skipped. The data seems to be missing somewhere.
Highcharts
.stockChart(
'container',
{
chart : {
type : 'heatmap',
marginTop : 40,
height : 500,
width : 900,
panning : true,
followTouchMove : true,
pinchType : 0,
followPointer : true,
inverted : true,
},
data : {
csv : data,
},
navigator : {
top : 40,
},
rangeSelector : {
buttons : [ {
count : 1,
type : 'minute',
text : '1M'
}, {
count : 5,
type : 'minute',
text : '5M'
}, {
type : 'all',
text : 'All'
} ],
inputEnabled : false,
enabled : false,
selected : 0
},
title : {
text : 'Live random data'
},
exporting : {
enabled : true,
buttons : {
contextButton : {
menuItems : [
{
textKey : 'viewData',
onclick : function() {
this.viewData();
$('#pausereset')
.toggleClass(
'optionsettable');
}
},
{
separator : true
},
{
textKey : 'downloadPNG',
onclick : function() {
var title = this.title.textStr;
this.exportChart({
type : 'image/png',
filename : title
});
}
},
{
textKey : 'downloadJPEG',
onclick : function() {
var title = this.title.textStr;
this
.exportChart({
type : 'image/jpeg',
filename : title
});
}
},
{
textKey : 'downloadPDF',
onclick : function() {
var title = this.title.textStr;
this
.exportChart({
type : 'application/pdf',
filename : title
});
}
},
{
textKey : 'downloadSVG',
onclick : function() {
var title = this.title.textStr;
this
.exportChart({
type : 'image/svg+xml',
filename : title
});
}
} ]
}
}
},
yAxis : {
scrollbar : {
enabled : true,
showFull : true
},
title : {
text : null
},
labels : {
format : '{value}:00'
},
/* minPadding : 50,
maxPadding : 20, */
/* tickPositions : [ 0, 6, 12, 18, 24 ], */
tickWidth : 0.5,
/* min : 0,
max : 33 */
},
xAxis : {
reversed : true,
scrollbar : {
enabled : true,
showFull : true
},
tickPixelInterval : 0.5,
},
plotOptions : {
dataLabels : {
enabled : true
},
heatmap : {
allowPointSelect : true
},
series : {
pointPadding : 0,
groupPadding : 0.1,
}
},
colorAxis : {
stops : [ [ 0, '#84D984' ], [ 0.5, '#127B12' ],
[ 0.9, '#005500' ] ],
min : -5
},
series : [ {
type : 'heatmap',
name : 'Random data',
borderWidth : 0,
showInNavigator : true,
turboThreshold : 0,
cropThreshold : 300,
/* colsize : 0.1 * 36e5, */
pointPadding : 0,
colsize : 0.1 * 36e5,
rowsize : 1,
tooltip : {
headerFormat : 'Temperature<br/>',
pointFormat : '{point.x: %H}:{point.x: %m} - {point.y}:00: <b>{point.value} ℃</b>'
},
} ]
});
Here is the jsfiddle link
You just need to increase the series.colsize value. In this case, you can set it equal to one hour interval, just like that:
series: [{
type:'heatmap',
borderWidth: 0,
pointWidth: '100%',
colsize: 36e5, // one hour
tooltip: {
headerFormat: 'Temperature<br/>',
pointFormat: '{point.x:%e %b, %Y} {point.y}:00: <b>{point.value} ℃</b>'
}
}]
Live example: http://jsfiddle.net/zpvdweab/1/
Here is my datagrid part in jsp:
<title>Device</title>
<script type="text/javascript">
var dataGrid;
$(function() {
dataGrid = $('#dataGrid').datagrid({
url : '${ctx}' + '/drivers/dataGrids',
striped : true,
rownumbers : true,
pagination : true,
singleSelect : true,
idField : 'id',
sortName : 'driversstatus',
sortOrder : 'desc',
pageSize : 15,
pageList : [ 10, 20, 30, 40, 50, 100, 200, 300, 400, 500 ],
frozenColumns : [ [ {
width : '100',
title : 'id',
field : 'id',
sortable : true
}, {
width : '80',
title : 'Device Name',
field : 'driversname',
sortable : true
} , {
width : '80',
title : 'Device ip',
field : 'driversip',
sortable : true
}, {
width : '80',
title : 'Device type',
field : 'driverstype',
sortable : true,
}, {
width : '80',
title : 'Device Status',
field : 'driversstatus',
sortable : true,
formatter : function(value, row, index) {
switch (value) {
case 0:
return 'Online';
case 1:
return 'Offline';
}
}
} ,{
width : '80',
title : 'Add Time',
field : 'addtime',
sortable : true,
}
] ],
toolbar : '#toolbar'
});
});
And here is my datagrid code in controller class:
#RequestMapping("/dataGrids")
#ResponseBody
public Grid jsonList(Drivers eqimInfo, PageFilter ph) {
Grid grid = new Grid();
grid.setPage(ph.getPage());
grid.setRows(driversService.dataGrid(eqimInfo, ph));
grid.setTotal(driversService.Count(eqimInfo, ph));
return grid;
}
Grid.class contains private attributes including page, rows and rowsCount, and their getter and setter; Drivers.class is the data class.
I can confirm that the returned Grid instances contains every data retrieved from the database, but the strange thing is that every columns have their values shown except the "Device Name" column, which drives me crazy......
Any suggestions?
Problem solved. Turns out that the first letter of the field in mySQL should use lower cases, otherwise jsp would not recognize it.
I am trying to apply a title to YAxis of my chart, it looks smudged (overlaps on each other) on the screen, whereas my other titles looks just fine.
My code :
yAxis: [{
title: {
text : 'User Count',
margin : 60,
style : {
fontWeight : '100%',
fontFamily : 'verdana'
}
}
}],
series: [{
data: [1,2,3,4,5,6,3,8,1,10,4,11]
}]
});
});
Sample: I get this in IE9, but not in FF and chrome. Please suggest a solution. I have been stuck with this for months. Thanks in Advance.
I have been trying to arrange the text inside the flag element for highstock similar to image below but been struggling for too long.
Was wondering if this is possible and how
Updated in jsfiddle
http://jsfiddle.net/wj9vvq6o/
$(function () {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=usdeur.json&callback=?', function (data) {
// Create the chart
$('#container').highcharts('StockChart', {
rangeSelector : {
selected : 1
},
title : {
text : 'USD to EUR exchange rate'
},
yAxis : {
title : {
text : 'Exchange rate'
}
},
series : [{
name : 'USD to EUR',
data : data,
id : 'dataseries',
tooltip : {
valueDecimals: 4
}
}, {
type : 'flags',
data : [{
x : Date.UTC(2011, 1, 22),
title : 'A',
text : 'Shape: "squarepin"'
}, {
x : Date.UTC(2011, 3, 28),
title : 'Test Name goes here <br> Test 2 goes here',
text : 'Shape: "squarepin"'
}],
onSeries : 'dataseries',
shape : 'squarepin',
width : 140
}, {
type : 'flags',
data : [{
x : Date.UTC(2011, 2, 1),
title : 'B',
text : 'Shape: "circlepin"'
}, {
x : Date.UTC(2011, 3, 1),
title : 'B',
text : 'Shape: "circlepin"'
}],
shape : 'circlepin',
width : 16
}, {
type : 'flags',
data : [{
x : Date.UTC(2011, 2, 10),
title : 'C',
text : 'Shape: "flag"'
}, {
x : Date.UTC(2011, 3, 11),
title : 'C',
text : 'Shape: "flag"'
}],
color : Highcharts.getOptions().colors[0], // same as onSeries
fillColor : Highcharts.getOptions().colors[0],
onSeries : 'dataseries',
width : 16,
style : {// text style
color : 'white'
},
states : {
hover : {
fillColor : '#395C84' // darker
}
}
}]
});
});
});
This is all i have managed - i need to add the number 100 beside it
You can try to set a useHTML flag in series object. Then arrange your content by HTML elements and CSS styles.
series:
{
useHTML:true,
dataLabels:{
useHTML:true,
},
type : 'flags',
data : [{
x : Date.UTC(2011, 1, 22),
title : 'A',
text : 'Shape: "squarepin"'
}, {
x : Date.UTC(2011, 3, 28),
title : '<span style="text-align:right;width:100%;display:block;">Test Name goes here </span>100 <br><span style="text-align:right;width:100%;display:block;">Test 2 goes here</span>',
text : 'Shape: "squarepin"'
}],
onSeries : 'dataseries',
shape : 'squarepin',
width : 140
},
Simple example: http://jsfiddle.net/wj9vvq6o/4/
I have to call the EnhancedGrid filter plugin from a function, but in EnhancedGrid the filter plugin has to be declare in order to work with filter.
grid = new EnhancedGrid({
id : 'grid',
store : yourStore,
structure : layout,
rowSelector : '20px',
plugins : {
search : true,
pagination : {
pageSizes : [ "50", "100"],
description : true,
sizeSwitch : true,
pageStepper : true,
gotoButton : true,
maxPageStep : 2,
position : "bottom"
},
filter : {
closeFilterbarButton : true,
ruleCount : 2
itemsName : "rows"
}
}
});
grid.placeAt("myGrid");
grid.startup();
}
});
How can I achieve this?
You can do it this way:
<div data-dojo-type="dijit.form.Button">
filter movies with the letter "T" at the beginn
<script type="dojo/method" data-dojo-event="onClick" data-dojo-args="evt">
// Filter the movies from the data store:
grid3.filter({Title: "T*"});
</script>
It's a snippet from a dojo Example : https://dojotoolkit.org/reference-guide/1.9/dojox/grid/example_Filtering_data.html
Regards