Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getData() {
- var URL = '@Url.Action("LoadData")';
- $.ajax({
- type: "GET",
- url: URL,
- data: { id_cource: $("#cource").val() },
- contentType: "application/json; charset=windows-2151",
- dataType: "json",
- success: function (response) {
- alert("Great! Записи были обновлены успешно");
- },
- error: function (msg) {
- debugger;
- alert("Error");
- }
- });
- jQuery(document).ready(function($) {
- $("#chart").kendoChart({
- @*theme: $(document).data("kendoSkin") || "default",*@
- title: {
- text: "Анкета организации",
- font: "14px Arial,Helvetica,sans-serif",
- position: "top"
- },
- legend: { position: "top" },
- chartArea: {
- // width: 800,
- height: 1200
- },
- dataSource: new kendo.data.DataSource({
- transport: {
- read: {
- url: '@Url.Action("LoadData", "Anketa_org")',
- data: { id_cource: $("#cource").val() },
- dataType: "json",
- type: "GET",
- contentType: "application/json; charset=windows-2151"
- }
- },
- schema: {
- fields: {
- Col1: { type: "double" },
- Col2: { type: "double" },
- Legend: { type: "string" }
- }
- }
- }),
- seriesDefaults: { type: "column" },
- series:
- [{
- name: "Важность критерия",
- field: "Col1"
- },
- {
- name: "Удовлетворение полученным",
- field: "Col2"
- }],
- categoryAxis: {
- field: "Legend",
- labels: {
- template: "<#= shortLabels(value) #>",
- rotation: -90
- },
- valueAxis: {
- labels: { format: "{0}%" },
- majorUnit: 10,
- max: 100
- },
- tooltip: {
- visible: true,
- format: "{0}%"
- }
- }
- });
- });
- function refresh() {
- var chart = $('#chart').data("kendoChart");
- var dataSource = new kendo.data.DataSource({
- transport: {
- read: {
- type: "GET",
- url: '@Url.Action("LoadData")',
- data: { id_cource: $("#cource").val() },
- contentType: "application/json; charset=windows-2151",
- dataType: "json",
- }
- },
- schema: {
- model:{
- fields: {
- Col1: { type: "double" },
- Col2: { type: "double" },
- Legend: { type: "string" }
- }
- }
- }
- });
- chart.dataSource = dataSource;
- chart.refresh();
- };
- Controller
- [HttpGet]
- public ActionResult BarCharts_org()
- {
- // WebMsgBox.Show("Привет");
- return View();
- }
- [HttpGet]
- public JsonResult LoadData(Guid id_cource)
- {
- var ListItems = new List<Item>();
- double[] tempVal_1 = new double[27];
- double[] tempVal_2 = new double[27];
- int cnt;
- ...
- for(int i=0;i<27; i++)
- {
- Item itm =new Item();
- itm.Col1 = tempVal_1[i];
- itm.Col2 = tempVal_2[i];
- itm.Legend = tempStr[i];
- ListItems.Add(itm);
- }
- return Json(ListItems, JsonRequestBehavior.AllowGet);
Add Comment
Please, Sign In to add comment