Solved

Google

Posted on 2013-05-19
4
233 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Hi all! Recently there was EE question and the person wanted to have a multi-column textbox <div> selection, so as a first step to answer I provided a link but that was not complete with JavaScript selection, but had a good style sheet. So as a ques…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

730 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