I am new to google visualization API. I need  to implement dashboard
in application using google visualization API
i am trying to get the data from sql database to generate barcharts
in .net application. I am able to generate the charts using creating a
datable and adding the data to google visualization.


GoogleAPI.aspx.cs

using GoogleVisualizationAPI;

namespace GoogleChartAPI
{
    public partial class GoogleAPI : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable dt3 = new DataTable();
            dt3.AddDataColumn(new DataColumn() { DataType =
DataType.String, Name = "Name" });
            dt3.AddDataColumn(new DataColumn() { DataType =
DataType.String, Name = "Manager" });
            dt3.AddDataColumn(new DataColumn() { DataType =
DataType.String, Name = "Tooltip" });
            dt3.AddDataCell(new DataCell() { Caption = "Alexander
Bykin", Value = new List<string> { "", "Perfect Programmer" } });
            dt3.AddDataCell(new DataCell() { Caption = "Steve
Ballmer", Value = new List<string> { "", "Microsoft General
President" } });
            dt3.AddDataCell(new DataCell() { Caption = "Scott
Guthrie", Value = new List<string> { "", "Vice president in the
Microsoft Developer Division." } });
            GVAPI.Visualization.Add(new Visualization() { Package =
VisualizationPackage.OrgChart, DataTable = dt3, DestObjectName =
this.visOrgChart.ID});
}
}
}

GoogleAPI.aspx


<%@ Register Assembly="GoogleVisualizationAPI"
Namespace="GoogleVisualizationAPI"
    TagPrefix="gvapi" %>

<!-- Import the GViz API -->
<script type="text/javascript" src="http://www.google.com/jsapi";></
script>

<!-- Load the columnchart GViz package. -->
<script type="text/javascript">
    google.load("visualization", "1.1", {packages: ["columnchart"]});
</script>

<body>
<gvapi:GoogleContainer ID="visOrgChart" ClassName="visualization"
runat="server" />
</body>


But i need to get the data from database by connecting to SQL
database .

            SqlConnection conn = new SqlConnection("connstr");
            conn.Open();
            System.Data.DataSet thisDataSet = new
System.Data.DataSet();
            SqlDataAdapter orderAdapter = new SqlDataAdapter("Select
*", conn);
            System.Data.DataTable datatable = thisDataSet.Tables[0];
            GVAPI.Visualization.Add(new Visualization() { Package =
VisualizationPackage.ColumnChart, DataTable = dt, DestObjectName =
this.visScatterChart.ID });

It is showing an error

Cannot implicitly convert type 'System.Data.DataTable' to
'GoogleVisualizationAPI.DataTable'

Please help me..



Thank you,

YC





-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
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