Thanks much, asgallant.  Your suggestion worked great, but adding the extra 
months before and after seems to result in an unwanted extra month label to 
appear at the end of the data:

<https://lh4.googleusercontent.com/-EFEJzumHuqw/UKqIyVKo84I/AAAAAAAAAAc/YNzOeDnN6D8/s1600/extraLabel.png>
but thankfully not at the beginning.  Is this something I can control?

Thanks again for any hints,

Ed

Here's the new code:

    <script type="text/javascript">
    var cdata = null;
    var rdata = null;
    var haxisOpts = {};

    var drawMChart = function()
    {
    var options = {
      width: '100%', 
      height: '100%', 
      isStacked: true, 
      legend: {position: 'none'}, 
      chartArea: {width: '80%', height: '80%'},
      hAxis: haxisOpts
    }; 
    
    var chart = new 
google.visualization.ColumnChart(document.getElementById('mchart'));
    chart.draw(rdata, options);

    google.visualization.events.addListener( chart, 'select',
    function() {
    var url = "/biz/dashboard/1018/revDetails.ajax";
    var sel = chart.getSelection();
    var dVal = rdata.getValue( sel[0].row, 0 );
    var dFormat = new google.visualization.DateFormat({pattern: 
"MM-dd-yyyy"});
    url += '?date=' + dFormat.formatValue( dVal );
    lightWindow( url );       
    }
);
    }
    
google.load("visualization", "1", {packages:["corechart", "controls"]});
 google.setOnLoadCallback(drawCharts);
function drawCharts() 
{
var colors = ['gold','blue','purple','violet','orange','lightblue'];
 // mChart
{
cdata = new google.visualization.DataTable();
rdata = new google.visualization.DataTable();
 var formatter = new google.visualization.NumberFormat( {prefix: '$', 
negativeColor: 'red', negativeParens: true} );
var dFormat = null;

dFormat = new google.visualization.DateFormat({pattern: "MMM"});
rdata.addColumn( "date", 'Month' );
cdata.addColumn( "date", 'Month' );

cdata.addColumn( "number", "New" );
cdata.addColumn( "number", "Repeat" );
 rdata.addRows(6);
cdata.addRows(6);
 rdata.addColumn( "number", 'Revenue' );
 haxisOpts.viewWindowMode='explicit';
haxisOpts.viewWindow = {};

haxisOpts.viewWindow.min = new Date('2012', '4', '1');
 rdata.setValue( 0, 0, new Date('2012', '5', '1') );
cdata.setValue( 0, 0, new Date('2012', '5', '1') );
 cdata.setValue( 0, 1, 376 );
cdata.setValue( 0, 2, 185 );
 rdata.setValue( 0, 1, 32923.87 );
formatter.format(rdata, 1);
 rdata.addColumn( "number", 'Revenue' );
 rdata.setValue( 1, 0, new Date('2012', '6', '1') );
cdata.setValue( 1, 0, new Date('2012', '6', '1') );

cdata.setValue( 1, 1, 256 );
cdata.setValue( 1, 2, 288 );
 rdata.setValue( 1, 2, 31346.8399999999 );
formatter.format(rdata, 2);
 rdata.addColumn( "number", 'Revenue' );

rdata.setValue( 2, 0, new Date('2012', '7', '1') );
cdata.setValue( 2, 0, new Date('2012', '7', '1') );

cdata.setValue( 2, 1, 269 );
cdata.setValue( 2, 2, 266 );
 rdata.setValue( 2, 3, 33314.18 );
formatter.format(rdata, 3);
 rdata.addColumn( "number", 'Revenue' );
 rdata.setValue( 3, 0, new Date('2012', '8', '1') );
cdata.setValue( 3, 0, new Date('2012', '8', '1') );

cdata.setValue( 3, 1, 314 );
cdata.setValue( 3, 2, 216 );
 rdata.setValue( 3, 4, 33018.3 );
formatter.format(rdata, 4);
 rdata.addColumn( "number", 'Revenue' );
 rdata.setValue( 4, 0, new Date('2012', '9', '1') );
cdata.setValue( 4, 0, new Date('2012', '9', '1') );

cdata.setValue( 4, 1, 366 );
cdata.setValue( 4, 2, 242 );
 rdata.setValue( 4, 5, 48925.4900000002 );
formatter.format(rdata, 5);
 rdata.addColumn( "number", 'Revenue' );
 haxisOpts.viewWindow.max = new Date('2012', '11', '1');
 rdata.setValue( 5, 0, new Date('2012', '10', '1') );
cdata.setValue( 5, 0, new Date('2012', '10', '1') );

cdata.setValue( 5, 1, 64 );
cdata.setValue( 5, 2, 62 );
 rdata.setValue( 5, 6, 6391.55 );
formatter.format(rdata, 6);
 if( dFormat != null )
{
dFormat.format( rdata, 0 );
dFormat.format( cdata, 0 );
}

drawMChart();
}
 }
    </script> 


On Friday, November 16, 2012 2:38:38 PM UTC-8, asgallant wrote:
>
> That happens when you use a continuous-type domain axis 
> (number/date/datetime/timeofday).  Set the hAxis.viewWindow.min and 
> hAxis.viewWindow.max options to values just outside your data range.  In 
> your case, you might want to use May 2012 for the min and Dec 2012 for the 
> max.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/WDB5eS_dl9IJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to