• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

Google

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
Isaac
Asked:
Isaac
  • 2
  • 2
1 Solution
 
Rainer JeschorCommented:
Hi,
what happens? What error do you get?
Which browser do you use? Any script error?
Thanks.
0
 
IsaacSharePoint Client Side DeveloperAuthor Commented:
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
 
Rainer JeschorCommented:
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
 
IsaacSharePoint Client Side DeveloperAuthor Commented:
Thanks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now