Zedgraph 차트 라이브러리를 사용하고 있지만 특정 조건에 따라 막대 그래프를 색칠 할 수없는 것처럼 보입니다. 다음 예문을 따라 가면 this tutorial에 있습니다.Zedgraph 라이브러리를 사용하는 막 대형 차트의 사용자 정의 색
내 경우에 value
이 5034 이상인 경우 student.pass_mark
변수 인 경우 바를 빨간색으로 표시하고 50 이상이면 녹색으로 표시하려고합니다. 아래는 제 코드입니다. 그것은 그 빨리 볼 수 있도록 어느 지금까지 단지 내가 100의 값, 80, 또한 (110) 등
Dim subject As String
Dim grade As Decimal
Dim colors As Color() = {}
Dim subject_names As String() = {}
For i = 0 To student.no_of_subjects
ReDim Preserve colors(i)
ReDim Preserve subject_names(i)
subject = student.subject_name
grade = student.grade
Dim x As Double = CDbl(i) + 1
Dim y As Double = grade
Dim z As Double = 0
list.Add(x, y, z)
If grade < student.pass_mark Then
colors(i) = Color.Red
Else
colors(i) = Color.Green
End If
subject_names(i) = subject
Next
Dim myCurve As BarItem = myPane.AddBar("Student Subject", list, Color.Blue)
'Dim colors As Color() = {Color.Red, Color.Yellow, Color.Green, Color.Blue, Color.Purple}
myCurve.Bar.Fill = New Fill(colors)
myCurve.Bar.Fill.Type = FillType.Solid
myCurve.Bar.Fill.RangeMin = 0
myCurve.Bar.Fill.RangeMax = 4
myPane.Chart.Fill = New Fill(Color.White, Color.FromArgb(220, 220, 255), 45)
myPane.Fill = New Fill(Color.White, Color.FromArgb(255, 255, 225), 45)
' Tell ZedGraph to calculate the axis ranges
' Set the XAxis labels
myPane.XAxis.Scale.TextLabels = subject_names
' Set the XAxis to Text type
myPane.XAxis.Type = ZedGraph.AxisType.Text
ZedChart.IsShowPointValues = True
ZedChart.AxisChange()
ZedChart.Refresh()
이 비록 저 붉은 제공, 나는 pass_mark를 보여 전체 차트에서 선을 그리려 학생이 패스 마크와 비교하여 특정 주제를 통과했거나 통과하지 못했습니다.