Today’s tip is about
Highcharts. Few months ago, we have talk about Highstock
JavaScript library. Well, Highcharts is pretty
much the same, since both are developed by Highsoft
Solutions AS. There are both pure JavaScript libraries for creating
interactive charts, each of them offering some cool options for creating
awesome charts for your website.Highcharts currently supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange and polar chart types.
Today’s challenge for Highcharts is to create a line chart with both OX and OY logarithmic axis. The result will be:
And the code:
<!DOCTYPE HTML>
<html>
<head>
<meta
http-equiv="Content-Type" content="text/html;
charset=utf-8">
<title>Highcharts
logarithmic OX and OY axis</title>
<script
type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">
</script>
<script
type="text/javascript">
$(function () {
$('#chart').highcharts({
chart: {
},
title: {
text: 'Logarithmic OX
and OY axis'
},
credits: {
href:
"http://e-blog-java.blogspot.ro/",
text: "Java Behind
Obvious",
style: {
fontSize: '12px'
}
},
exporting: {
width: 1000
},
xAxis: {
type: 'logarithmic',
min: 1,
max: 1000,
tickInterval: 1,
minorTickInterval: 0.1
},
yAxis: {
type: 'logarithmic',
min: 1,
max: 1000,
tickInterval: 1,
minorTickInterval: 0.1,
title: {
text: null
}
},
tooltip: {
headerFormat:
'Name: <b>{series.name}</b>
<br />',
pointFormat: 'OX value:
{point.x} <br/> OY value: {point.y}'
},
series: [{
name: "series
name",
data: [
[5,20],[40,45],[44,89],[50,70],[68,89],[71,191],
[87,265],[95,397],[332,344]
]
}]
});
});
</script>
<script
src="../../js/highcharts.js"></script>
<script
src="../../js/modules/exporting.js"></script>
</head>
<body>
<div id="chart"
style="width: 800px; height: 400px; margin: 0 auto"></div>
</body>
</html>
That’s it! Hope you like it! For more details and full documentation about Highcharts and Highstock, please visit official website.



