Hello,

I have used the Category Filter to create a dropdown that draws a gauge to 
display percentage of project completed based on the Project selected by 
the user.  The problem is, the first time the chart is rendered, it 
displays the value of the first item in the dropdown.  I'd like either the 
gauge to not display until a selection is made in the dropdown, or display 
value of 0 until a selection is made.

So for example, user has not yet selected a project (dropdown still says 
'Pick a Project', but the gauge is displaying 50 which is the value of 
'Project 1' which is the first item in the dropdown list:


It isn't until the user select PROJECT 1 from the dropdown, that I want to 
see 50 in the gauge:


Otherwise, it works beautifully!   Is there something that can be set in 
the configuration that will make it behave as I expect it to?  I've read 
the doco on the Category Filter and tried a few things specific to the ui 
but nothing changed the output.

Here is my logic. 


<script type="text/javascript" src="
https://www.google.com/jsapi";></script><script type="text/javascript">
      google.load("visualization", "1", {packages:["gauge", "corechart", 
"controls"]});
</script>

function drawTaskChart() {
   var chartdata = {dialog.object}._data;
  
   // Prepare the data
   var data = google.visualization.arrayToDataTable(
     chartdata
     );
        
    // set up gauge datatable
    var gaugeData = new google.visualization.DataTable();
    gaugeData.addColumn('string', 'Project');
    gaugeData.addColumn('number', 'Pct');
    var gauge1 = new google.visualization.ChartWrapper({
        chartType: 'Gauge',
        dataTable: gaugeData,
        containerId: 'charttasks',   
        options: {
            width: 150,
            height: 150,
            min: 0,
            max: 100,
            animation: {
                duration: 1000,
                easing: 'inAndOut'
            },
            redFrom: 0,
            redTo: 33,
            yellowFrom: 33,
            yellowTo: 66,
            greenFrom: 66,
            greenTo: 100,
            majorTicks: ['0', '20', '40', '60', '80', '100']
        },
        view: {
            rows: [0] // restrict to the first row only
        }
    });
    // Define category pickers for 'Project'
    var ProjectPicker = new google.visualization.ControlWrapper({
        controlType: 'CategoryFilter',
        containerId: 'Projects',
        options: {
            filterColumnLabel:'Project',
           // filterColumnIndex: 1, // filter on the 2nd column
            ui: {
                labelStacking: 'vertical',
                allowTyping: true,
                allowMultiple: false,
                caption: 'Pick a Project',
                label: 'Select a Project'
            }
        }
    });
    
    var dashboard = new 
google.visualization.Dashboard(document.getElementById('dashboard'));
 dashboard.bind([ProjectPicker], [gauge1]);
    dashboard.draw(data); 


Thank you in advance for your help!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to