Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.javascript > #8166
| Path | csiph.com!2.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!81.171.118.63.MISMATCH!peer03.fr7!futter-mich.highwinds-media.com!news.highwinds-media.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Alessandro Pellizzari <shuriken@amiran.it> |
| Newsgroups | it.comp.lang.javascript |
| Subject | Re: ajax mi blocca canvas |
| Date | 3 Jan 2017 13:28:29 GMT |
| Lines | 75 |
| Message-ID | <ed1n7tF4c8uU1@mid.individual.net> (permalink) |
| References | <o4e85k$112f$1@gioia.aioe.org> <ed13peFu6neU1@mid.individual.net> <o4fqiq$16ud$1@gioia.aioe.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | individual.net l0jHg+bRCxyo4oVPOqDBbACs4WheGCin7LMtdwWbU4UpXrcas= |
| Cancel-Lock | sha1:QnVz3uCJMPcsS7jqOBloqAJ5DMg= |
| User-Agent | Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) |
| X-Received-Bytes | 2869 |
| X-Received-Body-CRC | 1888653022 |
| Xref | csiph.com it.comp.lang.javascript:8166 |
Show key headers only | View raw
Il Tue, 03 Jan 2017 10:23:38 +0100, Enrico Maria Chellini ha scritto:
> ok.. immaginavo. quindi in questo caso scrivo tutto sulla pagina
> principale poi cosa dovrei caricare l'arry dei dati contenuti i questa
> porzione di codice , o la prozione di codice intera?
>
> data: [ {
> type: "line", showInLegend:
> true, lineThickness: 2, name:
> "Visits", markerType: "square",
> color: "#F08080", dataPoints: [
> { x: new Date(2010, 0, 3), y: 650 }, { x: new Date(2010, 0,
> 5), y: 700 }, { x: new Date(2010, 0, 7), y: 710 }, { x: new
> Date(2010, 0, 9), y: 658 }, { x: new Date(2010, 0, 11), y:
> 734 },
> { x: new Date(2010, 0, 13), y: 963 },
> { x: new Date(2010, 0, 15), y: 847 },
> { x: new Date(2010, 0, 17), y: 853 },
> { x: new Date(2010, 0, 19), y: 869 },
> { x: new Date(2010, 0, 21), y: 943 },
> { x: new Date(2010, 0, 23), y: 970 }
> ]
> },
> ]
Dipende da cosa vuoi fare, am se vuoi il massimo della personalizzazione
server-side, io genererei tutto l'object di configurazione di Chart:
options.php:
<?php
$options = [
'title' => [
'text': 'Site traffic',
'fontSize': 30,
],
...
];
header('Content-type: application/json');
print(json_encode($options));
pagina.html:
<!doctype html>
<html>
<head>
<title>CanvasJS Example</title>
</head>
<body>
<div id="chartContainer" style="height: 400px; width: 100%;"></div>
</body>
<script src="js/canvas/canvasjs.min.js"></script>
<script>
$(function() {
$.get('options.php')
.then(function(data) {
var chart = new CanvasJS.Chart("chartContainer", data);
chart.render();
});
});
</script>
</html>
Sono andato un po' a memoria con jQuery, forse c'è qualche bug, ma l'idea
è quella.
Bye.
Back to it.comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar
ajax mi blocca canvas Enrico Maria Chellini <bitit@bitit.it> - 2017-01-02 20:03 +0100
Re: ajax mi blocca canvas Alessandro Pellizzari <shuriken@amiran.it> - 2017-01-03 07:56 +0000
Re: ajax mi blocca canvas Enrico Maria Chellini <bitit@bitit.it> - 2017-01-03 10:23 +0100
Re: ajax mi blocca canvas Alessandro Pellizzari <shuriken@amiran.it> - 2017-01-03 13:28 +0000
Re: ajax mi blocca canvas gobitit@gmail.com - 2017-01-04 06:30 -0800
csiph-web