TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Qayyum ChauDhary
NA
27
2.6k
How to Make inspinia chart based on chart.js dynamic in mvc5
Apr 1 2020 1:39 AM
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: [ **
//What to use here? To replace this data? and get date from Database**
[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
; }
}
Reply
Answers (
1
)
HOW To Add script to the end of the ASP.NET page
Rich Text Box Control