Page 1 of 1

Problem with WPF Series Coloring

Posted: Wed Oct 29, 2008 9:11 pm
by 13048566
I am trying to upgrade my TChart from WinForms to WPF in our application. In the original app, I would override the DrawValue method on the Bar Series for our Volume Bars in order to give each bar a different color depending on the whether the Price is up or down. The code below worked great in the WinForms version (I replaced our logic with the Mod symbol to give you the same kind of effect). When I do this in the new WPF version, though, the app becomes very slow when showing a large number of data points (somewhere around 2000). I am assuming something has changed, maybe it is new-ing up a bunch of brushes? Is there a workaround to make this work again...

Code: Select all

    Public Overrides Sub DrawValue(ByVal valueIndex As Integer)
        If valueIndex Mod 3 = 0 Then
            Me.Color = Windows.Media.Colors.Green
        ElseIf valueIndex Mod 2 = 0 Then
            Me.Color = Windows.Media.Colors.Red
        Else
            Me.Color = Windows.Media.Colors.Yellow
        End If

        MyBase.DrawValue(valueIndex)
    End Sub
Also, I am having a hard time with all the methods in the TChart code, that don't show the summary of what the methods actually do. Could you guys start filling in the Summaries, so I have an idea of what effect calling a method will have. There are like a million methods and I have no idea what most of them do.

Thanks,
T-Mac

Posted: Fri Oct 31, 2008 2:52 pm
by narcis
Hi T-Mac,

WPF is slower than GDI+ and WinForms applications. We don’t think WPF was designed for intensive drawing, it was designed for asthetic drawing.

Regarding the problem you are having, it works fine for us here using latest TeeChart for .NET v3 release available at the client area. Which TeeChart version are you using?

Please notice WPF code-breaking changes in latest release described on the release notes.
Also, I am having a hard time with all the methods in the TChart code, that don't show the summary of what the methods actually do. Could you guys start filling in the Summaries, so I have an idea of what effect calling a method will have. There are like a million methods and I have no idea what most of them do.


I've reported your request to be enhanced for next releases.