Dojo chart generation function, dojochart generation
A function is written to generate a chart by passing parameters. The Code is as follows:
/*** Created by LZUGIS * @ param container * @ param type * @ param data * @ constructor */function AddChart (container, type, data) {require (["dojox/charting/Chart2D", "dojox/charting/themes/PlotKit/blue", "dojox/charting/action2d/Highlight ", "dojox/charting/action2d/Tooltip", "dojox/charting/action2d/MoveSlice"], function (Chart2D, themes, Highlight, Tooltip, MoveSlice) {var chart = new dojox. charting. chart2D (container); chart. setTheme (dojox. charting. themes. plotKit. blue); // set the topic switch (type) {case "bar": {// bar chart. addPlot ("default", {type: "Columns", gap: 8 // interval between control Columns}); break;} case "pie ": {// pie chart. addPlot ("default", {type: "Pie", labelOffset: 40 // control the display position of the annotation, "+" is inside, "-" is outside}); break ;} case "line": {// linear chart. addPlot ("default", {type: "Lines", markers: true, // whether the data point displays tension: "X" // The curve is smooth, "X" is similar to "S", and "x" is closed and smooth}); break;} case "stack": {// stacked chart. addPlot ("default", {type: "StackedColumns", gap: 8}); break;} default: {break;} var xStr = ["Monday ", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; // Add axes var myLabelFunc = function (text, value, precision) {return xStr [text-1] ;}; chart. addAxis ("x", {labelFunc: myLabelFunc}); chart. addAxis ("y", {vertical: true, fixLower: "major", fixUpper: "major"}); chart. addSeries ("Series A", data); new Highlight (chart, "default", {highlight: "lightskyblue"}); new Tooltip (chart, "default "); new MoveSlice (chart, "default"); // new Legend ({chart: chart}, "legend"); chart. render ();});}
The usage is simple as follows:
<!DOCTYPE HTML>
Dojo Problems
The submission of dojo ajax can be refreshed asynchronously on a single page. Use the following methods: dojo. xhrPost and dojo. xhrGet. You can also perform asynchronous refresh on the nested page by using the dojo. io. iframe method. Asynchronous Refresh can be implemented by entering the callback function in callback.
How to teach me excel chart functions?
Normal heart (916569245)