Public Class CustomLogarithmicYAxis
Inherits LogarithmicAxis
..
Public Sub ZoomY(visibleXRange As DoubleRange, area As SfChart)
Dim MinLogY, MaxLogY As Double
Dim Ymax, Ymin As Double
'GetExtremes(visibleXRange.Start, visibleXRange.End, Ymax, Ymin, area, Me)
Dim visibleXRangeMiddle As Integer = Math.Round(visibleXRange.Start + visibleXRange.Delta / 2)
Dim MiddleXRangePrice = MainWindow.BaseTicker.Minutes(visibleXRangeMiddle).Price
Dim YpercentRange As Integer = 50
Ymax = MiddleXRangePrice * (1 + (YpercentRange / 2) / 100)
Ymin = MiddleXRangePrice * (1 - (YpercentRange / 2) / 100)
MinLogY = Math.Floor(Math.Log(Ymin, LogBase))
MaxLogY = Math.Ceiling(Math.Log(Ymax, LogBase))
Me.VisibleRange = New DoubleRange(MinLogY, MaxLogY)
prevVisibleRange = Me.VisibleRange
' Console.WriteLine("CustomLogarithmicYAxis " & Me.Name & " ZoomY VisibleRange.Start " & Me.VisibleRange.Start & " VisibleRange.End " & Me.VisibleRange.End)
End Sub
End Class |
<chart:SfChart
x:Name="chart1"
Header="Days"
AreaBorderBrush="Blue" Foreground="White" AreaBackground="#FF5B5343" AreaBorderThickness="0"
Padding="0" Margin="0,15,0,0"
>
..
</chart:SfChart>
<chart:SfChart Grid.Row="1"
x:Name="chart"
AreaBorderBrush="Blue" Foreground="White" AreaBackground="#FF5B5343"
AreaBorderThickness="0" Padding="0" Margin="0,0,0,15"
>
..
</chart:SfChart> |
With SeriesPrice
.Name = NameOf(SeriesPrice)
.XBindingPath = NameOf(Minute.DateTime)
.YBindingPath = NameOf(Minute.Price)
.Interior = New SolidColorBrush(Color.FromArgb(255, 0, 255, 0))
.StrokeThickness = 1
.YAxis = YAxisPrice
.ItemsSource = TestColl.Tickers(0).Minutes
End With
chart1.Series.Add(SeriesPrice)
..
Private Sub ActualRangeChanged(sender As Object, e As ActualRangeChangedEventArgs) Handles customDateTimeCategoryXAxis.ActualRangeChanged
customDateTimeCategoryXAxis1.ZoomFactor = customDateTimeCategoryXAxis.ZoomFactor
customDateTimeCategoryXAxis1.ZoomPosition = customDateTimeCategoryXAxis.ZoomPosition
End Sub
Private Sub ActualRangeChanged1(sender As Object, e As ActualRangeChangedEventArgs) Handles customDateTimeCategoryXAxis1.ActualRangeChanged
customDateTimeCategoryXAxis.ZoomPosition = customDateTimeCategoryXAxis1.ZoomPosition
End Sub |
Public Class FastSteplineBitmapSeriesExt
Inherits FastStepLineBitmapSeries
Private customSegment As CustomFastStepLineBitmapSegment
…
Public Overrides Sub CreateSegments()
…
If customSegment Is Nothing And Segments.Count = 0 Then
customSegment = New CustomFastStepLineBitmapSegment(ActualXValues, YValues, Me)
Segments.Add(customSegment)
ElseIf (ActualXValues IsNot Nothing) Then
customSegment.SetData(xValues, YValues)
customSegment.Item = ActualData
GetType(FastStepLineBitmapSegment).GetMethod("SetRange", BindingFlags.InvokeMethod OrElse BindingFlags.Instance OrElse BindingFlags.NonPublic).Invoke(customSegment, Nothing)
End If
End Sub
End Class
|
Public Class CustomFastStepLineBitmapSegment
Inherits FastStepLineBitmapSegment
…
Public Overrides Sub Update(transformer As IChartTransformer)
…
UpdateVisual()
End Sub
Private Sub UpdateVisual()
…
' Checking the rendering pixel for its bounds.
Dim isInsideBound = series.Clip.Bounds.Contains(New Point(xStart, yStart)) And series.Clip.Bounds.Contains(New Point(xEnd, yEnd))
If isInsideBound Then
' Render the series.
Endif
End Sub
|