sain
-
Posts
6 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by sain
-
-
If I assign the step value some times the graphs are looks crazy. In my app there are 100 graphs and data is coming from different sources. I'm calculating Step value as shown below, my users are not satisfied the way graph looks.
Public Shared Sub Chart_CommonProperties(ByRef Chrt As ChartFX.WebForms.Chart, ByVal maxValue As Double, ByVal minValue As Double)Chrt.AxisY.LabelsFormat.Decimals = 1
Chrt.AxisY.LabelsFormat.CustomFormat =
"#0.0%"Chrt.AxisY.DataFormat.Decimals = 1
Chrt.AxisY.DataFormat.Format = ChartFX.WebForms.AxisFormat.Percentage
If (maxValue > 0) ThenChrt.AxisY.Max = maxValue * 1.5
ElseChrt.AxisY.Max = maxValue * 1.25
End If If (minValue > 0) ThenChrt.AxisY.Min = minValue * 0.75
ElseChrt.AxisY.Min = minValue * 1.25
End IfChrt.PlotAreaColor = Drawing.Color.FromArgb(255, 255, 255)
Chrt.AxisY.Grids.Major.Visible =
TrueChrt.AxisX.Grids.Major.TickMark = ChartFX.WebForms.TickMark.Outside
Chrt.AxisX.Grids.Major.Style = Drawing2D.DashStyle.Solid
Chrt.AxisX.Grids.Major.Width = 1
Chrt.AxisX.Grids.Major.Color = Drawing.SystemColors.ControlDark
Chrt.AxisX.Grids.Major.Visible =
FalseChrt.AxisY.Grids.Major.Style = Drawing2D.DashStyle.SolidChrt.AxisY.LabelValue = 1
Chrt.AxisY.ScaleUnit = 100
Chrt.AxisY.Grids.Major.Color = Drawing.SystemColors.ControlDark
'Chrt.AxisY.Step = 10 If Chrt.AxisY.Max - Chrt.AxisY.Min > 0 ThenDim stepvalue As Integer = Math.Round((Chrt.AxisY.Max - Chrt.AxisY.Min)) Select Case stepvalueCase 0Chrt.AxisY.Step = 0.1
Case 1Chrt.AxisY.Step = 0.1
Case 2Chrt.AxisY.Step = 0.2
Case 3Chrt.AxisY.Step = 0.3
Case 4Chrt.AxisY.Step = 0.4
Case 5Chrt.AxisY.Step = 0.5
Case 6Chrt.AxisY.Step = 0.6
Case 7Chrt.AxisY.Step = 0.7
Case 8Chrt.AxisY.Step = 0.8
Case 9Chrt.AxisY.Step = 1
Case 10Chrt.AxisY.Step = 1.5
Case ElseChrt.AxisY.Step = DetermineNextWholeTen((Chrt.AxisY.Max - Chrt.AxisY.Min) / 10)
End Select End If ''setting the charts varios properties like border, point label formats and graph colorChrt.PageColor = Color.White
Chrt.AllSeries.Border.Color = Drawing.Color.Black
Chrt.AllSeries.Border.Effect = ChartFX.WebForms.BorderEffect.Dark
Chrt.AllSeries.PointLabels.Visible =
TrueChrt.AllSeries.PointLabels.Angle = ERTSCONSTANTS.CHART_VALUES.POINT_LABEL_ANGLE_360
Chrt.AllSeries.Color = Drawing.Color.Black
Chrt.AllSeries.MarkerSize = 3
Chrt.AllSeries.MarkerShape = ChartFX.WebForms.MarkerShape.Rect
Chrt.AllSeries.Line.Width = 1
End Suby = Math.Ceiling(x)
Elsey = Math.Floor(x)
y = y - 1
End IfReturn y * 10 End FunctionThanks in advance.
-
I'm here with sending my source again:
Source Code for the above graphs
Public
Class SalesPrivate _PrdouctName As String
Private _Sales As Integer Public Property ProductName() As String GetReturn _PrdouctName End GetSet(ByVal value As String)_PrdouctName = value
End Set End Property Public Property Sales() As Integer GetReturn _Sales End GetSet(ByVal value As Integer)_Sales = value
End Set End PropertyPublic Sub New() End SubPublic Sub New(ByVal name As String, ByVal sales As Integer) Me._PrdouctName = nameMe._Sales = sales End SubEnd
ClassWebPage with button click events:
Partial Public Class _Default Inherits System.Web.UI.PageProtected Sub btnSample1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSample1.Click Dim prodsaleslist As New List(Of Sales)prodsaleslist.Add(New Sales("Sony", 10))prodsaleslist.Add(
New Sales("Panasonic", 30))prodsaleslist.Add(New Sales("Vizio", 55))prodsaleslist.Add(
New Sales("Toshiba", 70))Me.Chart1.DataSource = prodsaleslistSetChartCommonProperties(Chart1)
Chart1.Titles.Add(CreateTitle("TV Sales in 2008-2009")) End SubProtected Sub btnSample2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSample2.Click Dim prodsaleslist As New List(Of Sales)prodsaleslist.Add(New Sales("Honda", 120))prodsaleslist.Add(
New Sales("Accord", 335))prodsaleslist.Add(New Sales("BMW", 459))prodsaleslist.Add(
New Sales("Ford", 198))Me.Chart1.DataSource = prodsaleslistSetChartCommonProperties(Chart1)
Chart1.Titles.Add(CreateTitle("Car Sales Sales in 2008-2009")) End SubProtected Sub btnSample3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSample3.Click Dim prodsaleslist As New List(Of Sales)prodsaleslist.Add(New Sales("Shell", 1234))prodsaleslist.Add(
New Sales("British Petrolium", 3452))prodsaleslist.Add(New Sales("Exxon Mobile", 2352))prodsaleslist.Add(
New Sales("Texaco", 65432))Me.Chart1.DataSource = prodsaleslistSetChartCommonProperties(Chart1)
Chart1.Titles.Add(CreateTitle("Gas Sales in 2008-2009")) End SubPrivate Sub SetChartCommonProperties(ByVal chrt As ChartFX.WebForms.Chart)Chart1.Height = 500
chrt.AxisY.LabelsFormat.Decimals = 1
chrt.AxisY.DataFormat.Decimals = 1
chrt.AxisY.LabelsFormat.Format = ChartFX.WebForms.AxisFormat.Percentage
chrt.AxisY.DataFormat.Format = ChartFX.WebForms.AxisFormat.Percentage
chrt.AxisY.ScaleUnit = 100
chrt.AxisY.Step = 10
chrt.AxisX.Grids.Major.Visible =
False End SubPrivate Function CreateTitle(ByVal title As String) As ChartFX.WebForms.TitleDockableDim newTitle As New ChartFX.WebForms.TitleDockablenewTitle.Text = title
newTitle.Font =
New System.Drawing.Font(newTitle.Font, Drawing.FontStyle.Bold)Return newTitle End FunctionEnd
Class -
Hi everybody,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> I
-
Thanks for your reply. If I assign the Step=10 then it works fine for me. But, in my application I'm setting AxisY min and max values programatically. Some times the AxisY min value is 0 and Max value 1, in this case I don't see Labels on axisY except Zero. My question is can we able to get % and one decimal on AxisY labels without setting Step value?
Thanks in advance.
-
Hi All,
For the following code, when I apply axisY.ScaleUnit=100 then I 'm loosing all my axisY labels and gridlines. Any idea?
Chrt.AxisY.LabelsFormat.CustomFormat = "00.0%"
Chrt.AxisY.DataFormat.Decimals = 1
Chrt.AxisY.DataFormat.Format = ChartFX.WebForms.AxisFormat.Percentage
Bug in Resource Center
in Web Forms
Posted
I got the following screen when I click on AixsFormat link ( which is located under Value Format Class-> Format ->AxisFormat).