Note that there are some explanatory texts on larger screens.

plurals
  1. POMixed Charting DATA sources in the same CHART
    text
    copied!<p>I'm new in DOJO and I post here for the first time. I have a problem to create several lines on the same chart.</p> <p>I've done a simple test to simulate data and it works</p> <pre><code> dojo.require("dojox.charting.Chart2D"); makeCharts = function(){ //crée un nouvel objet graphique var chart1 = new dojox.charting.Chart2D("simplechart"); chart1.addPlot("line", {type: "Lines"}); chart1.addPlot("space", {type: "Areas", hAxis: "space x", vAxis: "space y"}); chart1.addPlot("histo", {type: "Bars", gap: 6, hAxis: "histo x", vAxis: "histo y"}); chart1.addAxis("histo x", { labels: [{value: 1, text: "Jan"}, {value: 2, text: "Feb"}, {value: 3, text: "Mar"}, {value: 4, text: "Apr"}, {value: 5, text: "May"}, {value: 6, text: "Jun"}, {value: 7, text: "Jul"}, {value: 8, text: "Aug"}, {value: 9, text: "Sep"}, {value: 10, text: "Oct"}, {value: 11, text: "Nov"}, {value: 12, text: "Dec"}] }); chart1.addAxis("histo y", {vertical: true, max: 10, stroke: "green", fontColor: "black", majorTick: {color: "red", length: 6}, minorTick: {stroke: "black", length: 3}}); chart1.addSeries("Series 1", [1, 2, 2, 3, 4, 5, 5, 7], {plot:"line", stroke: {color:"red"}}); chart1.addSeries("Series 2", [1, 2, 4, 2, 1, 6, 4, 5], {plot: "space", stroke: {color:"blue"}, fill: "lightblue"}); chart1.addSeries("Series 3", [1, 2, 2, 3, 4, 5, 5, 7], {plot: "histo", stroke: {color:"green"}, fill: "lightgreen"}); chart1.render(); </code></pre> <p>I Created another php file where I transform my data from Mysql to JSON. I want now to put the URL of my source to dojo AddSeries. There will be several sources, differents files sources of data.</p> <p>I don't know where to put my URL in the code.</p> <p>Thank you for the help.</p> <hr> <p>Thank you for your response.</p> <p>I've tried this but the "Series 1" doesn't work :</p> <pre><code> dojo.require("dojox.charting.Chart2D"); dojo.require("dojo.data.ItemFileWriteStore"); makeCharts = function(){ test_store = new dojo.data.ItemFileWriteStore({url: 'data_chart.php'}); var chart1 = new dojox.charting.Chart2D("simplechart"); chart1.addPlot("line", {type: "Lines"}); chart1.addPlot("space", {type: "Areas", hAxis: "space x", vAxis: "space y"}); chart1.addPlot("histo", {type: "Bars", gap: 6, hAxis: "histo x", vAxis: "histo"}); chart1.addAxis("histo x", { labels: [{value: 1, text: "Jan"}, {value: 2, text: "Feb"}, {value: 3, text: "Mar"}, {value: 4, text: "Apr"}, {value: 5, text: "May"}, {value: 6, text: "Jun"}, {value: 7, text: "Jul"}, {value: 8, text: "Aug"}, {value: 9, text: "Sep"}, {value: 10, text: "Oct"}, {value: 11, text: "Nov"}, {value: 12, text: "Dec"}]}); chart1.addAxis("histo y", {vertical: true, max: 10, stroke: "green", fontColor:"black", majorTick: {color: "red", length: 6}, minorTick: {stroke: "black", length: 3}}); chart1.addSeries("Series 1", {data :test_store,plot:"line", stroke: {color:"red"}}); {color:"black"}}); chart1.addSeries("Series 2", [1, 2, 4, 2, 1, 6, 4, 5], {plot: "space", stroke: {color:"blue"}, fill: "lightblue"}); chart1.addSeries("Series 3", [1, 2, 2, 3, 4, 5, 5, 7], {plot: "histo", stroke: {color:"green"}, fill: "lightgreen"}); chart1.render(); </code></pre> <p>My data_chart.php is a test : <code>&lt;?php echo"[1, 2, 2, 3, 4, 5, 5, 7]"; ?&gt;</code></p> <p>I'm lost, I don't know how to resolve this problem.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload