Dojo chart generation function, dojochart generation

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.