Solved

Google

Posted on 2013-05-19
4
231 Views
Last Modified: 2013-05-19
I have a snippet of code that works except when it comes to building my chart

// Initialize data object to hold chart data
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Name');
    data.addColumn('number', 'Planned RIP');
    data.addColumn('number', 'Actual RIP');
    data.addColumn('number', 'Anticipated RIP');
 
	var val1 = dataValues[0][1];
	var val2 = dataValues[0][2];
	var val3 = dataValues[0][3];

	data.addRow(['FY12', dataValues[0][1], null, null]);
	data.addRow(['FY12', null, dataValues[0][2], dataValues[0][3]]);

	val1 = dataValues[1][1];
	val2 = dataValues[1][2];
	val3 = dataValues[1][3];

	data.addRow(['FY13', dataValues[1][1], null, null]);
	data.addRow(['FY13', null, dataValues[1][2], dataValues[1][3]]);			

    var options = {
    	width: 600,
    	height: 400,
    	isStacked: true,
    title: chartTitle,
        titleTextStyle: { color: 'black', fontName: '"Arial"', fontSize: '15' },
        legend: { textStyle: { color: 'black', fontName: '"Arial"', fontSize: '12' } },
        tooltip: { textStyle: { fontName: '"Arial"' } },
        colors: ["#FFFF00", "green", "blue", "#FF8000", "Red"],
        backgroundColor: {
            fill: '#D8D8D8',
            strokeWidth: '0'
        },
        vAxis: {
            title: "Number of Sites", format: '#',
            titleTextStyle: { color: 'black', fontName: '"Arial"', fontSize: '16' },
            gridlines: { count: countVAxis, color: 'black' },
            minValue: minVAxis,
            maxValue: maxVAxis
        },
        hAxis: { title: "Year", titleTextStyle: { color: 'black', fontName: '"Arial"', fontSize: '16' } },
          colors: [
            '#FF8080',
            '#8080FF',
            '#FF0000',
            '#0000FF'],
          seriesType: "bars"
    }
    var chart = new google.visualization.ComboChart(document.getElementById(chartType));
    chart.draw(data, options);
}

Open in new window

0
Comment
Question by:Isaac
  • 2
  • 2
4 Comments
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39179586
Hi,
what happens? What error do you get?
Which browser do you use? Any script error?
Thanks.
0
 
LVL 5

Author Comment

by:Isaac
ID: 39179615
Not sure why this question was created. Looks like it was created twice.  must be a bug. Anway, Here it is here....   http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/Q_28132777.html
0
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 39179645
Ok, already posted on the other as well.
As you just posted part of the code, two recommendations:
try to use local JS debugger like built-in IE dev tools or Chrome/Iron or Firefox with Firebug extension. They will help you to easily identify some minor coding issues (like using of uninitialized variables, missing ;  ...)
If you have more complex logic in your script like combining multiple things, start with one component (eg the chart) with hard coded values and add functionality by functionality (and safe the intermediate results;))) to get to a successful end.
Just my 2ct.
HTH
Rainer
0
 
LVL 5

Author Closing Comment

by:Isaac
ID: 39179650
Thanks!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have answered several questions lately that were solved utilizing the power of jQuery's AJAX functions, so I thought I would write an article demonstrating the ease of use. Why should I use jQuery as opposed to regular JavaScript? Now I know…
PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question