Solved

Google

Posted on 2013-05-19
4
228 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
Comment Utility
Hi,
what happens? What error do you get?
Which browser do you use? Any script error?
Thanks.
0
 
LVL 5

Author Comment

by:Isaac
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
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 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)

743 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

8 Experts available now in Live!

Get 1:1 Help Now