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/