This commit is contained in:
Samuele E. Locatelli
2018-06-02 21:44:55 +02:00
parent aff06c3c2f
commit c33904975f
2 changed files with 7 additions and 10 deletions
+1 -2
View File
@@ -24,13 +24,12 @@ namespace MoonPro.WS
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void randomData()
public void randomData(int numVal)
{
JavaScriptSerializer js = new JavaScriptSerializer();
Context.Response.Clear();
Context.Response.ContentType = "application/json";
// genero numVal valori random inizio/fine...
int numVal = 100;
int maxMinutes = 30;
Random random = new Random();
visjsDsItem[] items = new visjsDsItem[numVal];
+6 -8
View File
@@ -12,7 +12,7 @@
$(document).ready(function () {
$.ajax({
type: "GET",
url: "/WS/MPData.asmx/randomData",
url: "/WS/MPData.asmx/randomData?numVal=200",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: ChartVis,
@@ -88,22 +88,21 @@
}
function OnError(response) {
var output = response.responseText.replace("{\"d\":null}", "");
var items = JSON.parse(output);
//console.log(items);
//console.log(JSON.parse(response.responseText));
// recupero il container grafico
var container = document.getElementById('visualization');
// ITES da deserializzazione risposta
var items = JSON.parse(output);
// gruppi
var groups = [
{
id: 1
, content: 'Macc 1'
, content: 'Stati'
},
{
id: 2,
content: 'Macc 2'
content: 'Tempi'
// Optional: a field 'className', 'style', 'order', [properties]
}
// more groups...
@@ -114,7 +113,6 @@
};
// Create a Timeline
var timeline = new vis.Timeline(container, items, groups, options);
//container.append(response.responseText);
}
})