Are you looking to filter the data client-side or server-side?  If client 
side, would a 
StringFilter<https://developers.google.com/chart/interactive/docs/gallery/controls#stringfilter>or
 
CategoryFilter<https://developers.google.com/chart/interactive/docs/gallery/controls#categoryfilter>control
 do what you want?

Incidentally, I would strongly recommend changing your javascript to set up 
your chart code from a document "ready" function to a callback from 
google.load (as you could run into the case where document ready fires 
before the API is finished loading):

function drawVisualization(dataValues) {
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Column Date');
    data.addColumn('number', 'Column Value');
    
    for (var i = 0; i < dataValues.length; i++) {
        data.addRow([dataValues[i].Date, dataValues[i].Value]);
    }
    
    new 
google.visualization.LineChart(document.getElementById('visualization')).
    draw(data, { title: "" });
}
function init () {
    $('#btnSearch').click(function() {
        $.ajax({
            type: 'POST',
            dataType: 'json',
            contentType: 'application/json',
            url: 'Default.aspx/GetData',
            data: '{}',
            success:
            function (response) {
                drawVisualization(response.d);
            }
        });
    });
}
google.load('visualization', '1', {packages:['controls'], callback: init});

On Friday, November 1, 2013 11:49:51 AM UTC-4, Missy wrote:
>
> Hello, 
>
> I am novice programmer in c# field.  I am trying to implement a search 
> function in to filter my google charts.  I am unable to figure out, how do 
> I go about doing this functionality, any help or example, would be very 
> much appreciated. 
>
> I would like the search criteria to filter chart data by name.
>
> aspx.
>
> <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" 
> AutoEventWireup="true"
>     CodeFile="Default.aspx.cs" Inherits="_Default" %>
> <asp:Content ID="HeaderContent" runat="server" 
> ContentPlaceHolderID="HeadContent">
>     <script type="text/javascript" 
> src="https://www.google.com/jsapi></script></asp:Content><asp:Content 
> ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
>     <h2>
>         Visual Search Testing with 'iFrame
>     </h2>
>     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" 
> type="text/javascript"></script>
>     <script type="text/javascript" src="//www.google.com/jsapi"></script>
>     <script type="text/javascript">
>         google.load('visualization', '1', { packages: ['corechart'] });
>     </script>
>     <script type="text/javascript">
>         $(document).ready(function ()
>         $('#btnSearch').click(function() {
>             $.ajax({
>                 type: 'POST',
>                 dataType: 'json',
>                 contentType: 'application/json',
>                 url: 'Default.aspx/GetData',
>                 data: '{}',
>                 success:
>                     function (response) {
>                         drawVisualization(response.d);
>                     }
>
>             });
>         })
>
>         function drawVisualization(dataValues) {
>             var data = new google.visualization.DataTable();
>             data.addColumn('string', 'Column Date');
>             data.addColumn('number', 'Column Value');
>
>             for (var i = 0; i < dataValues.length; i++) {
>                 data.addRow([dataValues[i].Date, dataValues[i].Value]);
>             }
>
>             new 
> google.visualization.LineChart(document.getElementById('visualization')).
>                 draw(data, { title: "" });
>         }
>  
>          
>     </script>
>
>     <asp:Label ID="Label1" runat="server" Text="Name/Ids"></asp:Label>
>     <asp:TextBox ID="btnSearch" runat="server" ></asp:TextBox>
>     
>     <div id="visualization" style="width: 600px; height: 400px;"></div>
>     
>      </asp:Content>
>
> c#
>
> using System;
> using System.Collections;
> using System.Configuration;
> using System.Data;
> using System.Linq;
> using System.Web;
> using System.Web.Security;
> using System.Web.UI;
> using System.Data.SqlClient;
> using System.Text;
> using System.Collections.Generic;
> using System.Web.Services;
>
>
> public partial class _Default : System.Web.UI.Page
> {
>     protected void Page_Load(object sender, EventArgs e)
>     {
>
>     }
>
>     [WebMethod]
>     public static List<Data> GetData()
>     {
>         List<Data> dataList = new List<Data>();
>
>         dataList.Add(new Data("CLAVS 2007-1 M2A", 77, "Oct"));
>         dataList.Add(new Data("CLAVS 2007-1 M2A", 0, "Oct"));
>         dataList.Add(new Data("CLAVS 2007-1 M2A", 78, "Oct"));
>         dataList.Add(new Data("CLAVS 2007-1 M2A", 82, "Oct"));
>         dataList.Add(new Data("CLAVS 2007-1 M2A", 425, "Oct"));
>  
>
>         return dataList;
>     }
>
>
> }
>
>

-- 
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/groups/opt_out.

Reply via email to