Hi all,
I've created a site where I get the data from SQL server and draw a chart.
Now everything works perfectly on my local machine (localhost), but when I
deploy it on the server, the chart don't show. Here's the code i use :
@using System.Data;
@using System.Collections.Generic;
@using System.Data.SqlClient;
@{
Layout = null;
string connectionString="Server=192.168.1.125,1433\\sqlexpress;
Database=HEK; Uid=sa; Pwd=lubelincek12121";
DataTable dt = new DataTable();
String rows = "";
using (SqlConnection conn = new SqlConnection(connectionString))
{
conn.Open();
using (SqlDataAdapter adapter = new
SqlDataAdapter("SELECT TOP 500 Datum, Sava, P1, P2, P3 FROM vws ORDER BY DATUM
DESC", conn))
{
adapter.Fill(dt);
List<string> rowsList = new List<string>();
// rowsList.Add("['Datum', 'Sava', 'RPWS1']");
foreach (DataRow row in dt.Rows)
{
//Converts your object into a DateTime (so that it's
properties can be accessed properly
DateTime yourDate = Convert.ToDateTime(row["Datum"]);
rowsList.Add("[new Date(" + yourDate.Year + ", " +
(yourDate.Month - 1) + ", " + yourDate.Day + ", " + yourDate.Hour + ", " +
yourDate.Minute + ", " + yourDate.Second + "), "
+ row["Sava"] + ", "
+ row["P1"] + ","
+ row["P2"] + ","
+ row["P3"] + "]");
}
rows = String.Join(", ", rowsList);
};
};
}@if (Roles.IsUserInRole("admin")||(Roles.IsUserInRole("hek"))){
<span style="color: rgba(0,0,0,.33)"><b></b>.</span>}else{
Response.Redirect("~/members/AdminError");}<html><head>
<title>Test Graph</title><script type='text/javascript'
src="http://www.google.com/jsapi"></script><script type="text/javascript"
src="/java/asgallant.LineChartAsAnnotatedTimeline[0.4b].js"></script><script
type="text/javascript">
function drawChart() {
var data1 = new google.visualization.DataTable()
data1.addColumn('datetime', 'Datum');
data1.addColumn('number', 'Sava');
data1.addColumn('number', 'P1');
data1.addColumn('number', 'P2');
data1.addColumn('number', 'P3');
data1.addRows([@Html.Raw(rows)]);
var chart = new
asgallant.LineChartAsAnnotatedTimeline(document.getElementById('chart_div'));
chart.draw(data1, {
title: 'Absolutni nivo vode',
height: 350,
width:850,
vAxis: {
minValue: 162,
maxValue: 164
}
});
}
google.load('visualization', '1', { 'packages': ['controls'] });
google.setOnLoadCallback(drawChart);</script></head>
<body>
<div id="chart_div"></div>
</body></html>
I've copied the whole folder with all java files and everything.
Any idead would be appreciated , m
--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.