Jump to content
Software FX Community

AxisY.ScaleUnit problem


sain

Recommended Posts

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

 

 

Link to comment
Share on other sites

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. 

 

 

 

Link to comment
Share on other sites

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) Then

Chrt.AxisY.Max = maxValue * 1.5

Else

Chrt.AxisY.Max = maxValue * 1.25

End If

If (minValue > 0) Then

Chrt.AxisY.Min = minValue * 0.75

Else

Chrt.AxisY.Min = minValue * 1.25

End If

Chrt.PlotAreaColor = Drawing.Color.FromArgb(255, 255, 255)

Chrt.AxisY.Grids.Major.Visible =

True

Chrt.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.Solid

Chrt.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 0

Chrt.AxisY.Step = 0.1

Case 1

Chrt.AxisY.Step = 0.1

Case 2

Chrt.AxisY.Step = 0.2

Case 3

Chrt.AxisY.Step = 0.3

Case 4

Chrt.AxisY.Step = 0.4

Case 5

Chrt.AxisY.Step = 0.5

Case 6

Chrt.AxisY.Step = 0.6

Case 7

Chrt.AxisY.Step = 0.7

Case 8

Chrt.AxisY.Step = 0.8

Case 9

Chrt.AxisY.Step = 1

Case 10

Chrt.AxisY.Step = 1.5

Case Else

Chrt.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 color

Chrt.PageColor = Color.White

Chrt.AllSeries.Border.Color = Drawing.Color.Black

Chrt.AllSeries.Border.Effect = ChartFX.WebForms.BorderEffect.Dark

Chrt.AllSeries.PointLabels.Visible =

True

Chrt.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 Sub

 

Private Shared Function DetermineNextWholeTen(ByVal value As Decimal) As DoubleDim x As Decimal = value / 10

Dim y As Integer

If x > 0 Then

y = Math.Ceiling(x)

Else

y = Math.Floor(x)

y = y - 1

End IfReturn y * 10

End Function

Thanks in advance.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...