Creating a line graph in jqplot


 
Thread Tools Search this Thread
Top Forums Programming Creating a line graph in jqplot
# 1  
Old 04-24-2012
Creating a line graph in jqplot

I have a piece of code here that should create a line graph consisting of two lines. It will not render the lines and neither the dates on the x-axis. The y-axis is apparently already scaled for the y-values, so the data interpretation went correctly for at least some of the data.
Does anybody see an immediate solution to having the lines displayed as well as the dates along the x-axis?
Code:
<html>
<script type="text/javascript" src="../jquery.min.js"></script>
<script type="text/javascript" src="../jquery.jqplot.min.js"></script>
<script type="text/javascript" src="../plugins/jqplot.canvasTextRenderer.min.js"></script>
<script type="text/javascript" src="../plugins/jqplot.canvasAxisLabelRenderer.min.js"></script>
<link rel="stylesheet" type="text/css" href="../jquery.jqplot.css" />
<link rel="stylesheet" type="text/css" href="../jquery.jqplot.min.css" />

<script type="text/javascript">
$(document).ready(function() {           
  var plot2 = $.jqplot('chart2', [source01, source02], {
    title: {
      text: 'Validation chart',
      show: true
    },
    axes: {
      xaxis: {
        renderer: $.jqplot.DateAxisRenderer,
        tickOptions: { formatString: '%e-%b-%Y' },
        min: "09-01-2008",
        max: "06-22-2009",
        tickInterval: "6 weeks",
      },
      y2axis: {
        tickOptions: { formatString: '%d' }
      }
    },
    seriesDefaults: {
	  lineWidth: 1,
	  markerOptions: { show: false }
	}
  });
});

source01 = [ 
['06/15/2009 16:00:00', 136.01],
['06/08/2009 16:00:00', 143.82],
['06/01/2009 16:00:00', 136.47],
['05/26/2009 16:00:00', 124.76],
['05/18/2009 16:00:00', 123.73],
['05/10/2009 16:00:00', 132.03]
];

source02 = [
['06/15/2009 16:00:00', 139.48],
['06/08/2009 16:00:00', 136.97],
['06/01/2009 16:00:00', 144.67],
['05/26/2009 16:00:00', 135.81],
['05/18/2009 16:00:00', 122.5],
['05/10/2009 16:00:00', 130.91]
];

</script>

<div id="chart2" style="width:400px;height:300px; "></div>
</html>

SOLVED: Requires the following additional file to work:

Code:
<script type="text/javascript" src="../plugins/jqplot.dateAxisRenderer.min.js"></script>


Last edited by figaro; 04-24-2012 at 02:12 PM.. Reason: Solution offered
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Creating a sequence of numbers in a line for 1000 files

Hi, I try to explain my problem , I have a file like this: aasdsaffsc23 scdsfsddvf46567 mionome0001.pdb asdsdvcxvds dsfdvcvc2324w What I need to do is to create 1000 files in which myname line listing a sequence of numbers from 0001 to 1000. So I want to have : nomefile0001.txt that must... (10 Replies)
Discussion started by: danyz84
10 Replies

2. Shell Programming and Scripting

Creating duplicate records from a single line

Hi All, I would like to create a 1 million duplicate records from a single fixed length row. Is there a simple way to create this quickly in unix. I am using korn shell on the AIX OS. For ex, 100234 XHYSDDS SDSD OUPUT (1 million rows) 100234 XHYSDDS SDSD . . . 100234 XHYSDDS SDSD... (5 Replies)
Discussion started by: saratha14
5 Replies

3. Shell Programming and Scripting

Problem creating graph with gnuplot with time on x-axis

Let me start by saying I'm new to gnuplot and not very good at unix at all.. Anyway, I'm each minute measuring temperature and humidity and saves the last 60 readings along with time in a textfile, values_minute. The contents of the file is formatted like this: time temperature humidity ... (8 Replies)
Discussion started by: hakro807
8 Replies

4. Shell Programming and Scripting

gnuplot flat line graph

Hi, I'm not able to find a solution because I cant find the exact keyword for this. I wanna make a graph like ive shown in the attachment. Could someone please share ideas on how to do this. Thanks! (3 Replies)
Discussion started by: jamie_123
3 Replies

5. Programming

Creating area graphs in jqplot

How can area graphs be created in jqplot? Example can be seen here: dygraphs JavaScript Visualization Library In the example the line graphs and the grid are superimposed on the area graphs. I dont think it is supported out of the box for jqplot. I would normally do this with a double fill: -... (0 Replies)
Discussion started by: figaro
0 Replies

6. Shell Programming and Scripting

Creating a new line using awk?

Is there a way while using awk to print out lines, to create a new line after every line that is being displayed? (2 Replies)
Discussion started by: puttster
2 Replies

7. UNIX for Dummies Questions & Answers

Rewriting line with tabs creating problem

Hi I have an input file which have random file in between.I have to manipulate each line and replace the character from position 5-10 with XXXXXX. But when I am writing this to on output file the tabs in between gets converted to normal space. Input file : 14207531131040896334R108 ... (4 Replies)
Discussion started by: akashtcs
4 Replies

8. UNIX for Dummies Questions & Answers

creating conditions for making a new line?

Basically I want to change this: a:b c:d:e f:g h:i:j k:l into a:b c d:e f:g h i:j k:l so like if there is two :'s in one line making the first into a new line. If anyone knows how to do this I would be very appreciative! (9 Replies)
Discussion started by: Audra
9 Replies

9. OS X (Apple)

creating a new profile from command line

Does any1 know how to preform such an operation on a mac? any help appreciated (2 Replies)
Discussion started by: cleansing_flame
2 Replies

10. Shell Programming and Scripting

Creating a line for printing

Hi All I need to create a report and need some help on the formating side. In this report, I gather information from 2 different files and produce the line. I was looking at having a variable for the full lenght of the line with spaces and using the substr to put the right fields in place. Is... (3 Replies)
Discussion started by: jhansrod
3 Replies
Login or Register to Ask a Question