Jump to content

 

Photo
* * * * * 2 votes

Selection by "zooming"


  • Please log in to reply
26 replies to this topic

#21 Eva

Eva

    Advanced Member

  • Members
  • PipPipPip
  • 365 posts
  • Gender:Female

Posted 24 April 2012 - 07:50 AM

Hi Xusan,

Numeric axis in RangeBar is working well. You can checkout the code of the sample app here.


<vcSdk:RangeBar xmlns:vcSdk ="clr-namespace:Visifire.Controls" x:Name="MyRangeControl" Height="30" Background="SkyBlue"
Minimum="0" Maximum="100000" ResizeEnabled="False"
NumberOfLabels="10"
NumberOfMinorTicks="10"
FromValue="{Binding FromValue, Mode=TwoWay}" ToValue="{Binding ToValue, Mode=TwoWay}">

</vcSdk:RangeBar>

Regards,
Eva

#22 maui

maui

    Member

  • Members
  • PipPip
  • 14 posts

Posted 22 August 2012 - 03:38 PM

Hi Eva,

thanks for the RangeBar, i am using it too. Maybe you can help me with the following issue:
I want to scale the RangeBar to five minutes with these lines:
MyRangeControl.Minimum = DateTime.Now;
MyRangeControl.Maximum = DateTime.Now + TimeSpan.FromMinutes(5);
Unfortunately, this code has no effect. I debugged the application and found out that minimum and maximum values are first set properly, but are overwritten a little later by this method:
private static void chart_Rendered(object sender, EventArgs e)
		{
			Chart chart = sender as Chart;
			Grid contentGrid = (chart.Parent as Grid).Parent as Grid;
			RangeBar rangeBar = contentGrid.Parent as RangeBar;
			rangeBar.Dispatcher.BeginInvoke(new Action(delegate
			{
				rangeBar.PositionLeftAndRightThumb();
				contentGrid.RowDefinitions[1].Height = new GridLength(chart.AxesX[0].Height, GridUnitType.Pixel);
				rangeBar._renderBlock = true;

                //These two lines will overwrite my values
                rangeBar.Minimum = (DateTime)chart.AxesX[0].ActualAxisMinimum;
				rangeBar.Maximum = (DateTime)chart.AxesX[0].ActualAxisMaximum;

				rangeBar._renderBlock = false;
				rangeBar.RenderLabels();
				if (rangeBar.FromValue == null)
				{  
					rangeBar.IsInternalValueSet = true;
					rangeBar.FromValue = chart.AxesX[0].ActualAxisMinimum;
					rangeBar.IsInternalValueSet = false;
					if (rangeBar.RangeChanged != null)
						rangeBar.RangeChanged(rangeBar, new RangeBarEventArgs()
						{  
							IsFromValueChanged = true,
							IsToValueChanged = false,
							FromValue = rangeBar.FromValue
						});
				}
				else
					rangeBar.UpdateLeftThumbVisualAndUpdateFromValue();
				if (rangeBar.ToValue == null)
				{
					rangeBar.IsInternalValueSet = true;
					rangeBar.ToValue = chart.AxesX[0].ActualAxisMaximum;
					rangeBar.IsInternalValueSet = false;
					if (rangeBar.RangeChanged != null)
						rangeBar.RangeChanged(rangeBar, new RangeBarEventArgs()
						{
							IsFromValueChanged = false,
							IsToValueChanged = true,
							ToValue = rangeBar.ToValue
						});
				}
				else
					rangeBar.UpdateRightThumbVisualAndUpdateToValue();
			}));
			rangeBar._chartRendered = true;
		}
Is there any solution to this problem or am i doing something wrong?

Best regards,
maui

#23 vivek

vivek

    Advanced Member

  • Team Visifire
  • PipPipPip
  • 3,605 posts
  • Gender:Male
  • Location:Bangalore

Posted 23 August 2012 - 05:15 AM

You can try setting Maximum property of RangeBar inside the Rendered event of chart itself.

Example:
rangeBar.Maximum = (DateTime)chart.AxesX[0].ActualAxisMaximum + TimeSpan.FromMinutes(5);

Regards,
Vivek
Team Visifire


#24 maui

maui

    Member

  • Members
  • PipPip
  • 14 posts

Posted 23 August 2012 - 10:29 PM

Hi vivek,

Thanks for the answer! This would work fine but my problem goes a little bit further.
The problem is that i use the RangeBar "live". My chart ist constantly filled with Datapoints during the measurement which lasts about 5 minutes. My intention was to use the RangeBar to select an area of the complete measured data and update two other chart elements on the basis of my selection. So far, i didn't manage to scale the XAxis of the RangeBar to 5 Minutes.
My workaround would be to use a normal chart to display the live measurement and swap this chart with a RangeBar filled with the complete measured DataSeries as soon as the measurement stops.
But i'm glad if you guys have a better idea :)

Bes regards,
maui

#25 vivek

vivek

    Advanced Member

  • Team Visifire
  • PipPipPip
  • 3,605 posts
  • Gender:Male
  • Location:Bangalore

Posted 27 August 2012 - 04:34 AM

I did not understand your query properly. It would be helpful if you can provide more details so that we can give you a solution accordingly.

Regards,
Vivek
Team Visifire


#26 maui

maui

    Member

  • Members
  • PipPip
  • 14 posts

Posted 27 August 2012 - 08:28 AM

Ok let me try again.
I have a dataseries for my measurement. A new LightDataPoint is added to that series every 0.1 milliseconds. Usually, the dataseries will contain about 6000 datapoints at the end of the measurement. Now, i don't want to save the complete series. That means i need some method to select the sequence i want out of my dataseries. The best way would be to add a RangeBar Control to my chart after I hit the "STOP"-button, but i don't know how to do that.

Let me know if you need some code!

Best regards,
maui

#27 vivek

vivek

    Advanced Member

  • Team Visifire
  • PipPipPip
  • 3,605 posts
  • Gender:Male
  • Location:Bangalore

Posted 28 August 2012 - 04:44 AM

I would suggest you to modify the range bar control according to your requirement? Please check the similar example below.

http://www.visifire....ar_control .php

Regards,
Vivek
Team Visifire





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users