microsoft / InteractiveDataDisplay.WPF

Interactive Data Display for WPF is a set of controls for adding interactive visualization of dynamic data to your application. It allows to create line graphs, bubble charts, heat maps and other complex 2D plots which are very common in scientific software. Interactive Data Display for WPF integrates well with Bing Maps control to show data on a geographic map in latitude/longitude coordinates. The controls can also be operated programmatically.
Other
970 stars 265 forks source link

Custom example with time axis #3

Open rentocika opened 6 years ago

rentocika commented 6 years ago

I've use IDD.WPF in my little WPF app for charting a real time data's. But I've a few problems - see the attached picture or follow https://stackoverflow.com/questions/47553610/interactivedatadisplay-wpf-making-dynamically-chart-as-values-recorder-appearanc

inis3

dvoits commented 6 years ago

Please see answer on StackOverflow: https://stackoverflow.com/questions/47553610/interactivedatadisplay-wpf-making-dynamically-chart-as-values-recorder-appearanc/47589722#47589722

rentocika commented 6 years ago

Time axis (Y) not move with adding datas. How to fix this? idd wpf 1

rentocika commented 6 years ago

Where you are?

rentocika commented 5 years ago

What about solution for this behavior or bug?

stanislas-mur commented 4 years ago

Hi, i had a similar problem, and found a solution (or workaround) : In your xaml, in the Window.Resources tag, add a style for a d3:PlotAxis :

        <Style TargetType="d3:PlotAxis" x:Key="PlotDate">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="d3:PlotAxis">
                        <Grid>
                            <custom:DateAxis x:Name="PART_Axis" 
                                 AxisOrientation="{Binding AxisOrientation, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                 Ticks="{Binding Ticks, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                 Foreground="{Binding Foreground, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
                            <ContentPresenter/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="IsTabStop" Value="False"/>
        </Style>

Then, in the ControlTemplate for the Chart, replace your custom axis (for the date) by a d3:PlotAxis with the new Style :

<d3:PlotAxis x:Name="PART_horizontalAxis"
                d3:Figure.Placement="Bottom" 
                AxisOrientation="Bottom"
                Style="{DynamicResource PlotDate}"
                Foreground="{TemplateBinding Foreground}">
        <d3:MouseNavigation IsHorizontalNavigationEnabled="{TemplateBinding IsHorizontalNavigationEnabled}" IsVerticalNavigationEnabled="{TemplateBinding IsVerticalNavigationEnabled}"/>
</d3:PlotAxis>

It should now work as expected. You might need to rework your LabelProvider though, as the ticks provided will not always be in the 0 to 1 range.

I hope my explanations were clear, and that it can help (even if the issue is almost 3 years old).

rentocika commented 4 years ago

@stanislas-mur Thanks for helping, but I think there is an error:

<Grid>
                            <custom:DateAxis x:Name="PART_Axis" 
                                 AxisOrientation="{Binding AxisOrientation, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                 Ticks="{Binding Ticks, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                 Foreground="{Binding Foreground, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
                            <ContentPresenter/>
                        </Grid>

What do you think ?

stanislas-mur commented 4 years ago

I copy-pasted the code from my project (which works), but there might be differences between our codes. So maybe there is an error, but I don't see it unfortunately.

rentocika commented 4 years ago

@stanislas-mur I have error on line: <custom:DateAxis x:Name="PART_Axis" The "custom" is not defined. It is your project name or what?

stanislas-mur commented 4 years ago

yes it is the namespace for my DateAxis. Replace it by your declared namespace (my bad)