Solved

Google

Posted on 2013-05-19
4
229 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Debugging step-by-step Jquery/Javascript 6 57
safari scroll causing z-index div to bounce 1 30
delete database record with modal 21 79
Error in JQuery 5 35
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
The viewer will learn how to dynamically set the form action using jQuery.
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…

932 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now