SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

0
0

A few More Quick Questions
1) I am sampling at 10ms , and have traces of 1 day in length typically, is there any way of getting it to start changing the scale to firstly seconds, then milliseconds as you zoom in on the x scale?

2)when I have a days worth of data on the screen ( see screenshot the red looks really bad) the lines look very busy because of all the data being shown and looks a bit of a mess. Is there any way of telling it to draw less points when zoomed out to make it look better? I will need all the points when zoomed in though.

3) Is there a way of zooming out …. not fully but to say the last zoom level or by 50% of the current zoom with a modifier of some kind? If not s dropdown or something?

4) is there any nice and neat way of collapsing some of the multi axis, or even better getting them to disappear when hiding the line from the legend?

Thanks

Images
  • You must to post comments
0
0

Hi there,

Regarding the questions:

  1. Surely, you can do this using LabelFormatters. Please, take a look at Screenshots, XPS Printing, X-Axis Text Labels tutorial, this should help.

  2. I think using of the CategoryDateTimeAxis would be a better choice in this case – is this suitable for you?

  3. Hm…surely, you can create custom modifiers – this allows you to do almost everything, or extend any of existing. Could you please provide more info, maybe screenshots for clarification which behavior do you need?

  4. I guess setting Visibility to Collapsed on axis should help, but you need to think up a way how to bind it… let us to think about it, I notify you if there is any nice solution.

Hope this helps,

Best regards,
Yuriy

  • wilx
    Am am now trying to add a RolloverModifier using MVVM. I have the modifier working fine, but having trouble binding to the Live Values box, as I am having trouble binding to the RolloverModifier as my ChartModifier and RolloverModifier are constructed in the ViewModel.
    
            public AnalogueChartViewModel()
            {
                XAxis = new DateTimeAxis
                {
                    VisibleRange = RangeFactory.NewRange(DateTime.Now.AddDays(-2), DateTime.Now),
                    DrawMinorGridLines = false,
                    AxisTitle = "X-Axis",
                    TextFormatting="MM/dd/yy",
                    SubDayTextFormatting="hh:mm:ss.fff",
                    //LabelFormatter = XLabelFormatter,
                    DrawMinorTicks = true
                };
                YAxes = new AxisCollection();
                SeriesSource = new ObservableCollection<IChartSeriesViewModel>();
                var xAxisDrag = new XAxisDragModifier();
                var zoomExtents = new ZoomExtentsModifier();
                var rubberBandZoom = new RubberBandXyZoomModifier();
                var panModifier = new ZoomPanModifier { ExecuteOn = ExecuteOn.MouseRightButton };
                _cursorModifier = new CursorModifier();
                _legendDataSource = new LegendModifier { GetLegendDataFor = 0 };
                _mouseWheelZoomModifier = new MouseWheelZoomModifier();
                _rollOverModifier = new RolloverModifier();
    
                MyChartModifier = new ModifierGroup(xAxisDrag, zoomExtents, rubberBandZoom, panModifier, _legendDataSource, _cursorModifier, _mouseWheelZoomModifier, _rollOverModifier);
                LegendVisible = false;
                CursorVisible = false;
           
            }
    
            RolloverModifier _rollOverModifier;
    
            public RolloverModifier RollOverMod
            {
                get { return _rollOverModifier; }
                set 
                { 
                    _rollOverModifier = value; 
                    OnPropertyChanged("RollOverMod");
                }
    
            }
    
    
            public ModifierGroup MyChartModifier
            {
                get { return _chartModifier; }
                set
                {
                    _chartModifier = value;
                    OnPropertyChanged("MyChartModifier");
                }
            }
    
            <!-- Define an area in the top left of the chart which binds to the RolloverModifier.RolloverData.SeriesInfo collection -->
            <!-- Each SeriesInfo contains information such as SeriesName, Color and Data Value at the mouse location -->
            <!-- This collection updates dynamically as the mouse is moved. We bind to it using an ItemsControl so if more series are -->
            <!-- added then the feedback also updates -->
            <ItemsControl Grid.Column="0" Grid.Row="1" 
                          BorderBrush="#55000000"
                          BorderThickness="2" Width="200" Height="200"                     
                          VerticalAlignment="Top"
                          HorizontalAlignment="Left"
                          Background="#77FFFFFF"
                          DataContext="{Binding MyChartModifier}" 
                          ItemsSource="{Binding RolloverData.SeriesInfo}" >
    
    
    
                <ItemsControl.ItemTemplate>
                    <DataTemplate DataType="SciChart:SeriesInfo">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition SharedSizeGroup="ColumnA"/>
                                <ColumnDefinition SharedSizeGroup="ColumnB"/>
                            </Grid.ColumnDefinitions>
    
                            <!-- Bind to the SeriesName using the SeriesColor as text foreground -->
                            <TextBlock Grid.Column="0" Text="{Binding SeriesName}" Margin="3,3,20,3" FontSize="13" FontWeight="Bold"
                                       Foreground="{Binding SeriesColor, Converter={StaticResource ColorToBrushConverter}}" />
    
                            <!-- Bind to the Series Value, using the SeriesColor as text foreground -->
                            <TextBlock Grid.Column="1" Text="{Binding Value, StringFormat={}{0:0.000}}" Margin="3,3,3,3" FontSize="13" FontWeight="Bold"
                                       Foreground="{Binding SeriesColor, Converter={StaticResource ColorToBrushConverter}}" />
                        </Grid>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
    
    Any help appreciated
    
  • wilx
    Ok... funny how I always sort it after I have posted the question. I was stuck on this problem for hoursI needed ( for anyone else who may want to do this)
    
                          DataContext="{Binding RollOverMod}" 
                          ItemsSource="{Binding RolloverData.SeriesInfo}" >
    
    
  • wilx
    On your replies to my Questions1. Surely, you can do this using LabelFormatters. Please, take a look at Screenshots, XPS Printing, X-Axis Text Labels tutorial, this should help. >>> I achieved what I wanted using SubDayTextFormatting as seen below. It works very well
               XAxis = new DateTimeAxis
                {
                    VisibleRange = RangeFactory.NewRange(DateTime.Now.AddDays(-2), DateTime.Now),
                    DrawMinorGridLines = false,
                    AxisTitle = "X-Axis",
                    TextFormatting="MM/dd/yy",
                    SubDayTextFormatting="hh:mm:ss.fff",
                    //LabelFormatter = XLabelFormatter,
                    DrawMinorTicks = true
                };
    
    2. I think using of the CategoryDateTimeAxis would be a better choice in this case – is this suitable for you? >>> I tried this, but it looks exactly the same visually when all the data is plotted.Why did you think this would help? What is the difference?3. Hm…surely, you can create custom modifiers – this allows you to do almost everything, or extend any of existing. Could you please provide more info, maybe screenshots for clarification which behavior do you need? >>> See screenshots attached. As you can see, I zoomed in from fully zoomed out to Level 1 zoom then on again to Level 2 Zoom. If I want to go back from Level 2 to Level 1 by some quick method, how could I achieve that? I don't really want to go back to fully zoomed out which is the only quick method I have ( double click to reset zoom) I would like double click to go back a zoom level. 4. I guess setting Visibility to Collapsed on axis should help, but you need to think up a way how to bind it… let us to think about it, I notify you if there is any nice solution. >>>I have not looked at this yet, but any help with a solution would be great.Thanks,
  • wilx
    Another problem, perhaps my problem with WPF knowledge but I am trying to use a combobox to select the Yaxis from a list
           <ComboBox Name="ComboName" Grid.Row="1" Grid.Column="1"  VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ItemsSource="{Binding Path=Axis}" DisplayMemberPath="AxisTitle"  >
    
    
           public ChooseAxisViewModel(AxisCollection axis)
            {
                Axis = axis;
            }
    
            AxisCollection _axis;
    
            public AxisCollection Axis
            {
                get { return _axis; }
                set 
                { 
                    _axis = value;
                    OnPropertyChanged("Axis");
                }
            }
        }
    
    
    I get the list of my Y-axis in the dropdown part of the ComboBox, but when I select an entry, it does not put the text into the combobox Text Field as if I can't select it. I have tried this with other objects with a string for a title and its fine. Any idea why I cannot do this? Is there something special about this?
  • Yuriy
    Hi there,1. Glad you sorted it out! Surely, using SubDayTextFormatting is working solution as well - it doesn't work for CategoryAxis, because it uses LabelFormatter to handle labels.2. There is a great article showing the difference between category and value axis, you could take a look at http://peltiertech.com/Excel/ChartsHowTo/CatVsValueAxis.html . But it don't think this will help in your case. You could try out using of different ResamplingModes(take a look at our Performance demo example, you can see this feature in action there). Try to set ResamplingMode to Mid for your series, but you will lose peak trough information in this case. Also, you need to handle VisibleRange changes listening to IAxis.VisibleRangeChanged event - switch to default ResamplingMode(MinMax) in the handler when the chart is zoomed in.The above allows you also to hold the last visible range(or even zooming history) and set it when you performs ZoomExtents. You need to extend existing ZoomExtents modifier or create your own and override OnModifierDoubleClick() method.Regarding Combobox binding, it's interesting issue... maybe connected with equality comparison for axes. Let us investigate it.Best regards, Yuriy
  • wilx
    .....Also, you need to handle VisibleRange changes listening to IAxis.VisibleRangeChanged event – switch to default ResamplingMode(MinMax) in the handler when the chart is zoomed in. The above allows you also to hold the last visible range(or even zooming history) and set it when you performs ZoomExtents. You need to extend existing ZoomExtents modifier or create your own and override OnModifierDoubleClick() method.Do you have any better documentation/examples on ZoomExtents as I don't really understand how they work, or better still an example of what you have explained above(MVVM), as I am also unsure of how to listen to VisibleRangeChanged events using MVVM and how to get at the visible range or zooming history. thanks.The ComboBox binding is driving me crazy now, surely it should have just worked?
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.