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
maideen kader
NA
155
0
How to change color of column in column chart using asp.net?
Apr 16 2020 8:26 PM
Hi
Pls adviceme to change color of each column in column chart
Below code works fine in only one color. I have 12 month. How to change the color of each month
Pls advice me
Thank you.
maideen
this is my code
<script>
var
chartData;
// globar variable for hold chart data
google.load(
"visualization"
,
"1"
, { packages: [
"corechart"
] });
// Here We will fill chartData
$(document).ready(
function
() {
$.ajax({
url:
"Default.aspx/LoadTotalQR_Month"
,
data:
""
,
dataType:
"json"
,
type:
"POST"
,
contentType:
"application/json; chartset=utf-8"
,
success:
function
(data) {
chartData = data.d;
},
error:
function
() {
alert(
"Error loading data! Please try again."
);
}
}).done(
function
() {
// after complete loading data
google.setOnLoadCallback(drawChart_C);
drawChart_C();
});
});
function
drawChart_C() {
var
data = google.visualization.arrayToDataTable(chartData);
var
options = {
title:
""
,
pointSize: 5
};
var
columnChart =
new
google.visualization.ColumnChart(document.getElementById(
'column-chart1'
));
columnChart.draw(data, options);
}
</script>
<WebMethod()>
Public
Shared
Function
LoadTotalQR_Month()
As
List(Of
Object
)
Dim
query
As
String
=
"SELECT SUM(AMOUNT) AS AMOUNT,MonthName,monthno FROM [dbo].[DP_Receipt_Head] "
&
"WHERE YEARNO = @YearNo Group BY MonthName,monthno order by Monthno"
Dim
constr
As
String
= ConfigurationManager.ConnectionStrings(
"ConnectString"
).ConnectionString
Dim
CharData_AREA
As
New
List(Of
Object
)()
CharData_AREA.Add(
New
Object
() {
"MonthName"
,
"AMOUNT"
})
Using con
As
New
SqlConnection(constr)
Using cmd
As
New
SqlCommand(query, con)
cmd.Parameters.AddWithValue(
"@YearNo"
,
Date
.Today.Year)
con.Open()
Using sdr
As
SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
While
sdr.Read()
CharData_AREA.Add(
New
Object
() {sdr(
"MonthName"
), sdr(
"AMOUNT"
)})
End
While
End
Using
Return
CharData_AREA
End
Using
End
Using
Function
Reply
Answers (
3
)
FileUpload control - files disappears
Global.asax file can be placed inside a subfolder