Did anybody use INSPINIA Theme in MVC and make its charts dynamic as to retrieve data from the database and display it through charts?
What help I am looking for is what to add in the controller and then use it in data field of graph:
- @Scripts.Render("~/plugins/flot")
- <script type="text/javascript">
- $(document).ready(function () {
- var barOptions = {
- series: {
- bars: {
- show: true,
- barWidth: 0.6,
- fill: true, fillColor: {
- colors: [{ opacity: 0.8 },
- { opacity: 0.8 }] } } },
- xaxis: { tickDecimals: 0 },
- colors: ["#1ab394"],
- grid: {color: "#999999",
- hoverable: true,
- clickable: true,
- tickColor: "#D4D4D4", borderWidth: 0 },
- legend: { show: false },
- tooltip: true,
- tooltipOpts: {content: "x: %x, y: %y" } };
- var barData = {label: "bar",
- data: [ **
- [1, 40], [2, 25], [3, 19], [4, 34], [5, 32], [6, 22] ] };
- $.plot($("#flot-bar-chart"), [barData], barOptions);
- var barOptions = {series: {
- lines: { show: true,
- lineWidth: 2,
- fill: true,
- fillColor: { colors: [{ opacity: 0.0 }, { opacity: 0.0 }] } } },
- xaxis: { tickDecimals: 0 },
- colors: ["#1ab394"],
- grid: { color: "#999999",
- hoverable: true,
- clickable: true,
- tickColor: "#D4D4D4", borderWidth: 0 },
- legend: { show: false },
- tooltip: true,
- tooltipOpts: { content: "x: %x, y: %y" } };
- var barData = {label: "bar",
- data: ** What to use here? To replace this data?** };
- doPlot("right"); $("button").click(function () {
- doPlot($(this).text()); }); });
Here I need some assistance in the Controller part, I want to retrieve on two values as x-axis & y-axis from the model (Worker) which is Name and Salary:
- public class Worker {
- public int ID { get; set; }
- public string Name { get; set; }
- public string Position { get; set; }
- public string Office { get; set; }
- public string Extn { get; set; }
- public string Salary { get; set; }
- }