JQUERY-based bar chart plug-in

Source: Internet
Author: User

1. Introduction to JQUBAR (V1.0) JQUERY plug-in
1. Supports. net, java, php, and other platforms.
2. You can drag the bar chart with the mouse to change the height of each column, and finally use the mouse to drag the graphic interface to modify server data.
3. Supports column chart scaling.
4. Currently, browsers such as IE7, IE8, Firefox, and Chrome are supported.

Ii. HTML
Copy codeThe Code is as follows: <div id = "con"> <% -- JQUBAR container -- %>
</Div>
<Input type = "checkbox" id = "cbZoom" checked = "checked"/>
<Label for = "cbZoom"> zoom </label>
<Input type = "checkbox" id = "cbDragable" checked = "checked"/>
<Label for = "cbDragable"> drag </label>
<Br/>
Name fuzzy query: <input type = "text" id = "txtName"/>
<Br/>
<Input type = "button" id = "btnReloadBar" value = "reload"/>

As follows:

Iii. Introduction of javascript and CSS files
Copy codeThe Code is as follows: <script src = "<% = Url. Content ("~ /Scripts/jquery-1.4.1.js ") %>" type = "text/javascript" charset = "UTF-8"> </script>
<Script src = "<% = Url. Content ("~ /Scripts/JQUBar/wz_jsgraphics.js ") %>" type = "text/javascript"> </script>
<Script src = "<% = Url. Content ("~ /Scripts/JQUBar/jquery-ui.min.js ") %>" type = "text/javascript"> </script>
<Script src = "<% = Url. Content ("~ /Scripts/JQUBar. js ") %>" type = "text/javascript"> </script>
<Link href = "<% = Url. Content ("~ /Scripts/JQUBar/JQUBar.css ") %>" rel = "stylesheet" type = "text/css"/>

Note: Please introduce the above files to html

4. Add Javascript code
Copy codeThe Code is as follows: <script type = "text/javascript">
$ (Function (){
$ ("# Con"). jQUBar ({
Zoom: true,
Drag: true,
Url: '<% = Url. Action ("LoadData") %>'
});
$ ("# BtnReloadBar"). click (function (){
$ ("# Con"). setBarParam ({
Zoom: $ ("# cbZoom"). attr ("checked "),
Drag: $ ("# cbDragable"). attr ("checked "),
// Json data is provided to facilitate. net java php calls. This example is demonstrated in Asp.net MVC2.0.
Url: '<% = Url. Action ("LoadData") %> /? Name = '+ $ ("# txtName"). val ()
}). Reload ();
});
});
</Script>

Note: add the preceding js script to html

V. ASP. NET MVC2.0 server code
Copy codeThe Code is as follows: private decimal [] GetPricesByEmployeeId (int employeeId)
{
Decimal [] result = null;
Result = _ Context. Orders. Where (o => o. EmployeeID = employeeId)
. Take (5)
. Select (oo => (decimal) oo. ShipVia). ToArray ();
Return result;
}
Public JsonResult LoadData (string name)
{
Var data = (from e in _ Context. Employees. Take (10). ToList ()
Select new
{
EmployeeID = e. EmployeeID,
Orders = GetPricesByEmployeeId (e. EmployeeID ),
Name = e. FirstName,
}). Distinct ();
If (! String. IsNullOrEmpty (name ))
{
Data = data. Where (d => d. Name. IndexOf (name)> = 0 );
}
Return Json (new {Success = true, Msg = data}, JsonRequestBehavior. AllowGet );
}

Note: For ease of reading and using the NORTHWIND database.

6. program running

Scaling:

Mobile:


Finally, the JQUBAR1.0 plug-in system cannot be tested due to a rush of time. If you are interested, you can download the JQUBAR1.0 plug-in here.

We sincerely thank you for your valuable comments on the plug-in. Based on your comments, I will take the time to upgrade the JQUBAR1.0 plug-in.

At the same time, I hope this article can help you solve problems encountered during development.
Author: RyanDing
Source: http://www.cnblogs.com/ryanding/

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.