I want to add annotations programmatically. I need to add line with arrow and textbox at Y1 and X1 of a line. It creates pointed annotation.
- Elteros Projektai asked 8 years ago
- last active 8 years ago
Hey guys,
I’m looking at changing the Numeric Axes on the Right and Left axes of my Chart, to right-align the Text within the Axis Labels.
I noticed this topic where Yuriy hinted that in 2.0 this would be a supported feature, but can’t seem to see what it would be:
http://http://www.scichart.com/questions/question/x-and-y-axis-formatting/
The “work around” featured in that topic doens’t seem to change anything in my situation.
I have tried setting FlowDirection to “RightToLeft”, which does the job, but has some ugly placement side-effects.
Is there something I’ve overlooked?
Thanks,
Miles
- bstapylton asked 10 years ago
- last active 7 years ago
I currently catch the MouseLeftButtonDown event like this:
<s:SciChartSurface
s:SciChartGroup.VerticalChartGroup="SharedChartGroup"
MouseLeftButtonDown="UIElement_OnMouseLeftButtonDown"
SeriesSource="{Binding ChartSeriesViewModels}">
But the event only fires when I click outside the chart area in an empty area (where the title goes). How can I modify the code so that the event fires when I click anywhere on the surface on the chart?
Also, how can I determine on which chartsurface the mouse click occurred?
- bbmat asked 8 years ago
- last active 8 years ago
I have the following code and want to move this portion to code-behind but have problems understanding how I can programmatically set the properties in Style:
<s:SciChartSurface.ChartModifier>
<!-- Provides Interactivity -->
<s:RubberBandXyZoomModifier IsAnimated = "False" IsXAxisOnly = "True" ExecuteOn = "MouseRightButton"/>
<s:ZoomPanModifier XyDirection="XYDirection" ClipModeX = "ClipAtExtents" ExecuteOn ="MouseLeftButton" />
<s:MouseWheelZoomModifier XyDirection = "XYDirection"/>
<s:ZoomExtentsModifier IsAnimated = "False" ExecuteOn = "MouseDoubleClick" />
<s:XAxisDragModifier DragMode = "Scale"/>
<s:CursorModifier SourceMode="AllSeries" UseInterpolation="True"/>
<!-- Provides selection of series and custom styling to the selected series -->
<s:SeriesSelectionModifier ReceiveHandledEvents="True" SelectionChanged="SeriesSelectionModifier_OnSelectionChanged">
<s:SeriesSelectionModifier.SelectedSeriesStyle>
<Style TargetType="s:BaseRenderableSeries">
<Setter Property="SeriesColor" Value="White"/>
<Setter Property="PointMarkerTemplate">
<Setter.Value>
<ControlTemplate>
<s:EllipsePointMarker Fill="#FF00DC" Stroke="White" Width="7" Height="7"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</s:SeriesSelectionModifier.SelectedSeriesStyle>
</s:SeriesSelectionModifier>
<!-- Provides a data source for the legend control -->
<s:LegendModifier ShowLegend="True" GetLegendDataFor="SelectedSeries" Margin="10"/>
</s:ModifierGroup>
</s:SciChartSurface.ChartModifier>
Particularly the SeriesSelectionModifier and its property setters seem difficult for me to implement in code-behind. Can you please provide some sample code how I would actually implement the SeriesSelectionModifier with above Property Setters above in C# code rather than in XAML?
Thanks
- bbmat asked 8 years ago
- last active 8 years ago
I looked at the Multi-pane stock charts example and fail to understand how I can have the height of my panes change dynamically during runtime as function of updated window size (SizeChanged event) or when adjusting the number panes in the chartgroup? Problem with the below code is that when I resize the window only the first pane in chartgroup is changed not any of the other panes. What am I missing? Do I need to also bind the SciChartSurface.Height within the ItemTemplate to Height for each individual pane height? (I commented out the Height property binding in SciChartSurface. Would I need that?). Either way the panes do not resize when the whole window resizes. I made sure the events all fire and “ChartGroupHeight” is properly updated each time the window is resized.
I implemented the following in my view:
<i:Interaction.Triggers>
<i:EventTrigger EventName="SizeChanged">
<mvvm:EventToCommand
Command="{Binding UserControlResizedCommand, Mode=OneWay}"
EventArgsConverterParameter="{Binding ElementName=LayoutRoot}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
<UserControl.Resources>
<!-- This allows setting the Height of a pane from a viewmodel -->
<Style x:Key="ChartPaneStyle" TargetType="s:SciChartGroupPane">
<Setter Property="Height" Value="{Binding ChartGroupHeight, Mode=TwoWay}"/>
</Style>
<!-- A number of converters which change parameters of charts based on the IsFirstChartPane property -->
<resources:BoolToValueConverter x:Key="MinorsPerMajorConverter" TrueValue="4" FalseValue="2"/>
<resources:BoolToValueConverter x:Key="MaxAutoTicksConverter" TrueValue="8" FalseValue="4"/>
<resources:BoolToValueConverter x:Key="GrowByConverter" >
<resources:BoolToValueConverter.TrueValue>
<s:DoubleRange Min="0.02" Max="0.02"/>
</resources:BoolToValueConverter.TrueValue>
<resources:BoolToValueConverter.FalseValue>
<s:DoubleRange Min="0.02" Max="0.02"/>
</resources:BoolToValueConverter.FalseValue>
</resources:BoolToValueConverter>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="32" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" Background="Black">
<TextBlock Text="Dataseries Type:" Margin="5,0" VerticalAlignment="Center" FontSize="12" Foreground="White"/>
<ComboBox x:Name="ComboBox_ChooseSeriesType" MinWidth="140" Margin="5,3" VerticalContentAlignment="Center"/>
<TextBlock Text="Theme:" Margin="5,0" VerticalAlignment="Center" FontSize="12" Foreground="White"/>
<ComboBox x:Name="ComboBox_ChooseTheme" MinWidth="140" Margin="5,3" VerticalContentAlignment="Center"/>
</StackPanel>
<s:SciChartGroup
Grid.Row="1"
ItemsSource="{Binding ChartPaneViewModels}"
s:ThemeManager.Theme="{Binding ElementName=ComboBox_ChooseTheme, Path=SelectedItem}"
ItemContainerStyle="{StaticResource ChartPaneStyle}">
<s:SciChartGroup.ItemTemplate>
<DataTemplate>
<s:SciChartSurface
s:SciChartGroup.VerticalChartGroup="SharedChartGroup"
SeriesSource="{Binding ChartSeriesViewModels}">
<!--Height = "{Binding Height}">-->
<s:SciChartSurface.XAxis>
<s:DateTimeAxis Visibility="Visible"
LabelProvider="{Binding XAxisFormatting}"
VisibleRange="{Binding ParentViewModel.XVisibleRange, Mode=TwoWay}"
GrowBy="0.02, 0.02"/>
</s:SciChartSurface.XAxis>
<s:SciChartSurface.YAxis>
<s:NumericAxis AxisAlignment="Right"
Visibility="Visible"
TextFormatting="{Binding YAxisTextFormatting}"
GrowBy="0.02, 0.02"
AutoRange="Always"/>
</s:SciChartSurface.YAxis>
<s:SciChartSurface.ChartModifier>
<s:ModifierGroup s:MouseEventGroup="SharedMouseGroup">
<!-- Provides Interactivity -->
<s:RubberBandXyZoomModifier IsAnimated = "False" IsXAxisOnly = "True" ExecuteOn = "MouseRightButton"/>
<s:ZoomPanModifier XyDirection="XYDirection" ClipModeX = "ClipAtExtents" ExecuteOn ="MouseLeftButton" />
<s:MouseWheelZoomModifier XyDirection = "XYDirection"/>
<s:ZoomExtentsModifier IsAnimated = "False" ExecuteOn = "MouseDoubleClick" />
<s:XAxisDragModifier DragMode = "Scale"/>
<s:CursorModifier SourceMode="AllSeries" UseInterpolation="True"/>
<s:LegendModifier ShowLegend="True" LegendPlacement ="Inside" GetLegendDataFor="AllSeries" Margin="10"/>
<!-- Provides selection of series and custom styling to the selected series -->
<!--<s:SeriesSelectionModifier ReceiveHandledEvents="True">
<s:SeriesSelectionModifier.SelectedSeriesStyle>
<Style TargetType="s:BaseRenderableSeries">
<Setter Property="SeriesColor" Value="White"/>
<Setter Property="PointMarkerTemplate">
<Setter.Value>
<ControlTemplate>
<s:EllipsePointMarker Fill="#FF00DC" Stroke="White" Width="7" Height="7"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</s:SeriesSelectionModifier.SelectedSeriesStyle>
</s:SeriesSelectionModifier>-->
<!-- Provides a data source for the legend control -->
</s:ModifierGroup>
</s:SciChartSurface.ChartModifier>
</s:SciChartSurface>
</DataTemplate>
</s:SciChartGroup.ItemTemplate>
</s:SciChartGroup>
</Grid>
- bbmat asked 8 years ago
- last active 11 months ago
Hi,
I have a chart for a temperature line using FastLineRenderableSeries and a couple of HorizontalLineAnnotation to show some thresholds for that line.
When I call DataSeriesSet.InvalidateParentSurface(RangeMode.ZoomToFit) the chart zoom to fit the data from the data series (which is fine).
Now I would like to be able to zoom to the chart extents but including those threshold line. What would be the best way to accomplish this?
Screen shots attached.
Chart with RangeMode.ZoomToFit: c1
Chart manually zoomed out to show threshold line: c2
(the chart is that small green dot that is showing just bellow the lower threshold)
The goal is to be able to provide a feature that my users can zoom chart so that both data set and thresholds are shown. I guess a variation of the current zoom to fit but taking into account the annotation lines.
Thanks!
- jsimoes asked 10 years ago
- last active 5 years ago
I’m using the latest version of the chart. when I run everything works fine, but when I open a XAML file with a chart the error window has:
The name “ZoomPanModifier” does not exist in the namespace “clr-namespace:Abt.Controls.SciChart;assembly=Abt.Controls.SciChart.Wpf”
And I get one of these for each control such as ZoomPanModifier, TextAnnotation, SeriesSelectionModifier etc…
How do I fix this issue?
- kelias asked 10 years ago
- last active 8 years ago
How do I implement zooming in real time charts. The examples are all static data, and the zooming works, and a couple of links I found, do not explain it very well.
How can I accomplish zooming on a real time SciChart?
- darlon asked 9 years ago
- last active 6 years ago
I want to implement a PopUpWindowAction and InteractionRequestTrigger via the Micrsoft PRISM Libray:
But it starts with basic problems:
I’m not able to create a correct invokeCommandAction, the RaisItemSelection method gets never executed?
Xaml:
<s:SciChartSurface>
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction Command="{Binding MouseDoubleClickCommand}" CommandParameter="{}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</<s:SciChartSurface>
xaml.cs:
MouseDoubleClickCommand = new DelegateCommand<object>(RaiseItemSelection);
private void RaiseItemSelection(object obj)
{
}
- Daniel Hartl asked 9 years ago
- last active 9 years ago
I am using WPF SciChart version 1.3.1.1107 under the MVVM pattern.
I’ve included some sample code from a couple of my view models for reference purposes but it identical to sample code I copied from your examples.
My problem is that the data values arrive in a non sorted date time order and as a result my chart line does not connect the points based on the xaxis datetime value, but instead connects the points based on when the codes adds the points to the data series.
Do you have a feature that will allow me to plot a line based on a date time values?
IDataSeries dataSeries = ChartDataSeriesSet.AddSeries(); private IDataSeriesSet _chartDataSeriesSet = new DataSeriesSet(); public IDataSeriesSet ChartDataSeriesSet { get { return _chartDataSeriesSet; } set { _chartDataSeriesSet = value; NotifyPropertyChanged("ChartDataSeriesSet"); } } private IDataSeries _dataValues = null; public IDataSeries DataValues { get { return _dataValues; } set { _dataValues = value; NotifyPropertyChanged("DataValues"); } }
- sdemooy asked 11 years ago
- last active 9 years ago
I am creating custom controls and when I inherit from any annotation class (not AnnotationBase), public override void OnApplyTemplate() is called but any this.Template.FindName always returns null. If I inherit directly from ContentControl everything works correctly. I have tried inheriting from CustomAnnotation, BoxAnnotation, AnchorPointAnnotation and several others, all give the same result. I have checked the annotation classes and they all eventually inherit from ContentControl.
- Jason Neeley asked 7 years ago
- last active 6 years ago
When displaying a graph in a chart, I would like to set my own range and tickmark values. So when setting a range from -0.15 to 0.65 with the majortickmark set to 0.1, I would like to see Yvalues of 0.65, 0.55, 0.45, 0.35 till -0.15.
When using it now, it will move the axis to display nice round numbers
(see green graph in the attachment).
How can I do this?
Thanks,
Egbert
- EJansen asked 10 years ago
Hi,
I have a very strange problem. When starting my application with referenced SciChart DLL in “Release” mode all works fine.
If I start in DEBUG (Any CPU) mode, I get an error when loading the DLL’s and the application crashes:
“‘SeverVisual.exe’ (Managed (v4.0.30319)): Loaded ‘p:\Projects_ITS\project_sever\SeverVisual\bin\Debug\Abt.Controls.SciChart.Wpf.dll’
First-chance exception at 0x7550b9bc in SeverVisual.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x00148e74..
‘SeverVisual.exe’ (Managed (v4.0.30319)): Loaded ‘Abt.Controls.SciChart.Wpf&’
First-chance exception at 0x7550b9bc in SeverVisual.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0014ab60..”
In Debugx86 the error message also appears in the output window, but the application can start.
Thanks for help!
- dewulf asked 10 years ago
how can i apply styling for legend in legend modifier? i want to apply the following style
<Style x:Key="LegendStyle" TargetType="s:LegendModifier">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<s:SciChartLegend x:Name="legendControl" Margin="2,2" Orientation="Horizontal" Background="Transparent" BorderThickness="0" ScrollViewer.VerticalScrollBarVisibility="Auto"
Visibility="{Binding IsLegendVisible,Converter={StaticResource BoolToVisibilityConverter}}"
LegendData="{Binding LegendData, ElementName=legendModifier,Mode=OneWay}">
<s:SciChartLegend.Resources>
<SciChart:ColorToBrushConverter x:Key="ColorToBrushConverter"/>
</s:SciChartLegend.Resources>
<s:SciChartLegend.ItemTemplate>
<DataTemplate DataType="SciChart:XyzSeriesInfo">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0"
VerticalAlignment="Center"
Stretch="Fill"
Width="10"
StrokeThickness="10"
Stroke="{Binding SeriesColor,
Converter={StaticResource ColorToBrushConverter}}" />
<TextBlock Grid.Column="1" Foreground="Black"
Margin="2,0,15,0"
HorizontalAlignment="Center"
Text="{Binding SeriesName}" FontWeight="Normal"/>
</Grid>
</DataTemplate>
</s:SciChartLegend.ItemTemplate>
</s:SciChartLegend>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
- Raghupathy asked 9 years ago
- last active 9 years ago
Hi,
I’ve got the following scenario that I need to implement and it would be very nice if you could give me a jump-start. I need to bind the x-axes values represented by 2 vertical lines and the y-axis values represented by 2 horizontal lines to a viewmodel, so that the values inside the viewmodel change when moving the lines per mouse on the screen and the other way around (see mockup for how it should look like). I think the rollover modifier could be usable for this, but I need some pseudo code or an example app on how to bind the rollover modifiers value to the viewmodel and how to display 4 rollover modifiers on the chart surface.
Thanks
Joerg
- Joerg Hoehn asked 11 years ago
- last active 2 years ago
On my x axis, how can I keep from showing duplicate ticks?
On my y axis, how do I right justify all my values?
- tpayton asked 10 years ago
Hi!
Got a wierd issue. My client is installing my application (built with Scichart) and everything works fine, except on the laptop of this one particular guy, where the zoom does a wierd thing. It zooms the axes, but the graph is not moving. I’m quite sure there is nothing wrong with my application as it works everywhere else, but can any of you think of anything that I should check on this guys machine? I am at a complete blank here…
Thanks for helping me out….
- Lisbeth Skogland asked 10 years ago
- last active 2 years ago
I am trying to add Zoom capability to application that is based on ECG Monitor sample. As ECG Monitor manages VisibleRange, I need to stop setting VisibleRange when zoom is started. I am setting flag in RubberBandXyZoomModifier.OnModifierMouseDown.
Is there any way to create a custom ChartModifier to be notified when the user clicks mouse down on the chart, or axis?
- manishdoshi asked 11 years ago
- last active 11 months ago
Hi all,
I want to capture the XY coordinate related to XY axis of my scichartsurface after a MouseLeftButtonDown. At first I try this:
Point mousePoint = e.GetPosition(((SciChartSurface)sender));
but the coordinates are in pixel? instead I want my xy that are double…
Then I try this code from an example:
Point mousePoint = e.GetPosition(((SciChartSurface)sender).GridLinesPanel as UIElement);
var hitTest = ((SciChartSurface)sender).RenderableSeries[0].HitTest(mousePoint);
now hitTest.XValue and hitTest.YValue are the correct data of the nearest point, but I want the exactly coordinates of the point where I clicked, not the nearest. It is possible? How can I do?
Thanks for reply
- 10tony89 asked 10 years ago
I’m wondering what the established methods would be for the following scenario:
You generate data in your own assembly and dump it into an XyDataSeries and point or line render series with an IChartSeriesViewModel object and bind that using the SeriesSource api.
But it is relatively common to have additional metdata about a given datapoint that is keyed to something other than an X or Y value. For example, the plot may be based on the a computed number that is independent of a time value, but you still want to display the time value for that chart in the rollover tooltip.
What are the options for dealing with this in scichart?
Best and thanks!
- dsantimore asked 10 years ago
- last active 9 months ago
Hey super helpful and awesome SciCharts gurus,
I’m trying to create a graph that has usable data in a specific range, say 80-100, and I’m wondering if there is a way to lock the y axis range absolutely? This would override any kind of updating that ZoomPan or other modifiers might try to do.
Thanks!
Ryan
- rcannon asked 10 years ago
Hi guys,
After adding a YAxis to the left of my SciChart I’ve noticed that this code no longer functions as I expect:
public override void OnModifierMouseDown(ModifierMouseArgs e) { base.OnModifierMouseDown(e); if (ParentSurface.RenderableSeries.First().XAxis == null) return; if (!_mouseDragged && IsFunctional) { _mouseDragged = true; _selectionStart = (DateTime) ParentSurface.RenderableSeries.First().HitTest(e.MousePoint).XValue; } }
_selectionStart should be a Date under the cursor where the user has just clicked. Instead it’s a Date approx. 40pixels to the right of where the user has just clicked because the Left YAxis is approx. 40 pixels, and the ModifierMouseArgs.MousePoint is considering the YAxis space into it’s X coordinate value.
So when I take that point and perform a HitTest, I am not getting the expected result here.
I will write a fix for this to take into account a Left Y Axis if one exists and modify the point’s X coordinate value, but I thought to give you a heads-up in case this is outside of expected functionality and is indeed a bug.
Cheers,
Miles
- bstapylton asked 11 years ago
- last active 7 months ago
Hi I’m just wondering if there is anyway to force Y values to show up on the chart for all data points like a Histogram. I’ve attached screenshots to show what I would like the final screen to look like (ChartTest) so you have an idea. Hoping there is a way to force rollover to always show, or maybe have axis markers on the bottom that can display the y value at each x point. Hopefully you understand what I’m trying to achieve. Thanks.
- Kohins asked 10 years ago
- last active 6 years ago
Hi,
I’ve created a custom annotation and have set it’s .IsEditable property in code so the user can reposition it. I have two issues:
1.I want the user to be able to resize the “PPZLine” in the X direction, but I can’t figure out how to get the anchor points to appear.
- I want to be able to see the chart data that the annotation is covering. I tried setting AnnotationCanvas = BelowChart, but then I couldn’t move the annotation or get any annotation mouse handlers to trigger.
Here’s the annoation’s xaml:
<s:CustomAnnotation x:Class="CinchV2DemoWPF.Views.SciChart.PPZView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:CinchV2="clr-namespace:Cinch;assembly=Cinch.WPF"
xmlns:meffed="clr-namespace:MEFedMVVM.ViewModelLocator;assembly=MEFedMVVM.WPF"
xmlns:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:s="clr-namespace:Abt.Controls.SciChart;assembly=Abt.Controls.SciChart.Wpf"
meffed:ViewModelLocator.ViewModel="PPZViewModel"
X1="{Binding X1}"
Y1="{Binding Y1}"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- price line must use margin 0,0 or obj will not be visible-->
<s:BoxAnnotation Name="LongEntryMarker" Grid.Row="0"
Width="20" Height="10" Background="DarkViolet" Margin="0,0" VerticalAlignment="Top"
HorizontalAlignment="Right"
>
</s:BoxAnnotation>
<!-- long marker line MouseRightButtonDown="LongEntryMarker_OnMouseRightButtonDown"-->
<s:BoxAnnotation Name="PPZLine" Grid.Row="1"
Width="150" Height="5" Background="red" Margin="0,0" VerticalAlignment="Top"
>
</s:BoxAnnotation>
</Grid>
</s:CustomAnnotation>
- tecman234 asked 10 years ago
- last active 8 years ago
Hi all,
Sorry for yet another overview question!
We are trying to modify the colours of the Overview. The various properties on the SciChartOverview itself provide all-but-one element that needs to change colour.
The one remaining element is the SciChartSurface.GridLinesPanelStyle underneath the Overview.
See the screenshot for what I’m interested in changing the colour of 🙂
Thanks!
Miles
- bstapylton asked 10 years ago
- last active 9 years ago
Hi,
Annotation chart sample Drag Horizontal Threshold allow us to draw custom controllable color for the data series. The same way I need to draw the chart surface background color. I couldn’t find the appropriate API to do this job. Could you advise how to draw surface background color.
Update:
Attached the graph image, I like to draw the grey and white backgrounds based on horizontal and vertical line positions.
Thanks.
- Santhoshkumar asked 9 years ago
- last active 9 years ago
My problem is that I’m setting VisibleRange of the DateTimeAxis dynamicaly. Can i use staticly declared GrowBy property to add offsets to current Min and Max values?
- sarat12 asked 10 years ago
Hello,
I am evaluating the possibility to use SciChart for our corporate project, and now trying to create a series using data binding, strict MVVM (no code in code behind). The data we have are provided as an ObservableCollection, and the series would need to use the property “SomeKey” for X-Axis value, and the property “SomeValue” for the Y-Axis. Is it possible to do this, and if yes, then how?
Best regards
Petr Osipov
Rohde & Schwarz
- PetrOs asked 10 years ago
Hi,
I’m using the following code to create a text annotation:
private void AddLabel(DateTime StartTime, DateTime EndTime, string label)
{
TextAnnotation text = new TextAnnotation();
text.YAxisId = "LeftAxis";
text.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;
text.Text = label;
text.CoordinateMode = AnnotationCoordinateMode.RelativeY;
text.X1 = StartTime;
text.X2 = EndTime;
text.Y1 = .05;
text.Y2 = 0;
text.TextAlignment = TextAlignment.Center;
text.TextStretch = Stretch.UniformToFill;
text.Background = new SolidColorBrush(Color.FromArgb(0x80, 0x80, 0x80, 0x80));
text.BorderBrush = new SolidColorBrush(Color.FromArgb(0xC0, 0xD0, 0xD0, 0xD0));
text.BorderThickness = new Thickness(2);
sciChart.Annotations.Add(text);
}
Unfortunately the text doesn’t scale like I want it to though. The size of the text stays the same even when the chart is small, making the height greater than .05. Is there a way to make the text get smaller as the chart is shrunk so that it stays within the .05 Y boundary?
I attached 2 images to illustrate the issue.
Thanks,
Greg
- Sean Clifford asked 10 years ago
- last active 8 years ago
I am using the MVVM pattern.
I trying to manage the number of YAxes in my chart in a dynamic manner by binding the YAxes in the chart to a collection so that each time I add a new line series that line series gets its own axis.
When I do this I am getting a null reference expection.
If I hard code the YAxes or YAxis my chart loads.
Here is the xaml:
<SciChart:SciChartSurface x:Name="historicalChart"
RenderableSeries="{Binding HistoricalRenderableSeries, Mode=TwoWay}"
YAxes="{Binding ChartYAxes, Mode=TwoWay}"
SciChart:ThemeManager.Theme="ExpressionLight">
...
</s:SciChartSurface>
Here is the ViewModel
I tried both an ObservableCollection and a AxisCollection in my view model.
private ObservableCollection<NumericAxis> _chartYAxes = new ObservableCollection<NumericAxis>();
public ObservableCollection<NumericAxis> ChartYAxes
{
get { return _chartYAxes; }
set
{
_chartYAxes = value;
NotifyPropertyChanged("ChartYAxes");
}
}
private AxisCollection _chartYAxes = new AxisCollection();
public AxisCollection ChartYAxes
{
get { return _chartYAxes; }
set
{
_chartYAxes = value;
NotifyPropertyChanged("ChartYAxes");
}
}
Can anyone suggest a way to manage a variable number of YAxes in a chart?
- sdemooy asked 11 years ago
- last active 8 years ago
I want YAxis Auto Scale less than the value max 10% and greater value min 10%, how?
- kingsoff asked 10 years ago
- last active 8 years ago
Hi guys!
I have a bit of a challenge with annotations. I am running an mvvm application in which you can create annotations dynamically. I can’t seem to get a grip on how to manage these in a good way. My current “workaround” is to handle onAnnotationCreated and use that to add an object to my viewmodel. But then, as my underlying data changes the chart gets redrawn so I need to handle a load event on the scichart and then redraw them based on the information in my view model. Any thoughts on a better way to solve this?
However now the story gets even more interesting. I need to give my users the option of changing color, stroke and such on these annotations. How could I do this? And then how would I manage to keep my viewmodel updated with these changes?
- Lisbeth Skogland asked 10 years ago
Hello,
I am trying to get a right charting control for my boss , excuse me if am not using the right terms I am new to both WPF and SciCharts. Based on this example https://www.scichart.com/Abt.Controls.SciChart.SL.ExampleTestPage.html#/Abt.Controls.SciChart.Example;component/Examples/IWantTo/InspectDatapoints/SeriesVerticalSlicesExample.xaml , I am having the following difficulties:
Changing label background color of a VerticalLineAnnotation ( the one in blue lying below the X axis in the example)
I have been trying to figure out how to change the Vertical Slices’ labels background color (or make the label’s box transparent in order to see only the labels’ values and not the color around the label) but am not gettting a way out.Position the Curve – ‘Vertical slice’ intersection point y-axis value at the top end of the slice ( from the example, assuming i have only one curve say Curve A, the label ‘Curve A : 0.69’ shouldn’t appear right at the point of intersection between the curve and the slice but at the top end of the slice)
Would someone help please. Thank you in advance.
- Kilosa Magali asked 8 years ago
- last active 7 years ago
Hi Guys,
My Sci Chart has dates along the X-Axis. So far my data is at week level (one point for each week).
Ideally I would like to have a subtle grid line at each week, a more noticeable grid line to represent the start of each month, and a major grid line to represent the start of each year.
I understand that the current implementation of the XAxis seems to only use Minor and Major gridlines.
I am interested in drawing grid lines such that:
one minor vertical grid-line is drawn on the start of each week
one medium vertical grid-line is drawn on the start of each month
one major vertical grid-line is drawn on the start of each year
And for these grid lines to be drawn regardless of the current visible range or “zoom” of the chart.
Is there a simple tutorial or some snippet of code illustrating what I need to overwrite in a custom class in order to get this functionality into my chart?
Thanks again,
Miles
- bstapylton asked 11 years ago
- butek asked 9 years ago
- last active 6 years ago
Hi,
I am trying to build a chart with two series in it. One is an OHLC chart with the time on the X axis and price on the Y Axis. The other is an Bar chart with the price as the X Axis and an integer scale for the YAxis. The bar chart will need be have horizontal columns though which will need to align with the prices on the OHLC series. I have attached an image here with what the chart should look like, is there a way to achieve this ?
- deepakb1 asked 10 years ago
I am directly editing my XyDataSeries on a chart by using my mouse. As the mouse moves I edit either the x or y value of a point using the methods
public void SetPointYValueAt(IDataSeries series, int index, double newValue)
{
series.YValues[index] = newValue;
series.InvalidateParentSurface(RangeMode.None);
}
public void SetPointXValueAt(IDataSeries series, int index, double newValue, double xMin, double xMax)
{
var xValue = newValue;
// limit x values to keep them sorted
if (xValue < xMin) xValue = xMin;
if (xValue > xMax) xValue = xMax;
series.XValues[index] = xValue;
series.InvalidateParentSurface(RangeMode.None);
}
With this code I am not getting an update at my ViewModel:
public IDataSeries<double, double> MyDataSeries
{
get { return _myDataSeries; }
set
{
_myDataSeries = value;
OnPropertyChanged("MyDataSeries");
}
}
Here is my XAML:
<sciChartExtensions:StepLineRenderableSeries x:Name="HResitivitySeries" IsDigitalLine="True" DataSeries="{Binding MyDataSeries, Mode=TwoWay}">
Where StepLineRenderableSeries is derived from FastLineRenderableSeries with IsDigitalLine = true and the HitTest method overridden.
How can I get MyDataSeries to update?
- Stephen Painchaud asked 8 years ago
- last active 8 years ago
Hi,
I have a surface with multiple dataseries in it. I have a legend for each serie, setup like this:
chart.ChartModifier = new Abt.Controls.SciChart.ChartModifiers.LegendModifier() { Name = "legendModifier" }; var legend = new Abt.Controls.SciChart.Visuals.SciChartLegend { Margin = new Thickness(5) }; // Bind the legend to the data source var legendDataBinding = new Binding("LegendData") { Source = chart.ChartModifier }; legend.SetBinding(Abt.Controls.SciChart.Visuals.SciChartLegend.LegendDataProperty, legendDataBinding);
And it works fine.
However, I would also like to bind the visibility of the legends to the visibility of the dataseries. I have tried this:
// Bind the legend visibility to the data source var legendVisibilityBinding = new Binding("Visibility") { Converter = new BoolToVisibilityConverter(), Source = line.IsVisible }; legend.SetBinding(Abt.Controls.SciChart.Visuals.SciChartLegend.LegendDataProperty, legendVisibilityBinding);
But it doesn’t seem to work, any suggestions, anyone?
BR
Jacob
- JacobB asked 9 years ago
- last active 9 years ago
…sucks. Likely a programming error.
Trying to show a larger chart which has 16000 annotations on it. Besides that being a programming error at this point – we do / will have zoom out charts with that many data points.
I spend minutes, literally, in
Annotations.Add – no way to add an enumeration of them.
SuspendUpdates
has been called around this – so updates SHOULD not happen, but it seems there is a lot of overhead here.
What is adviced?
Besides that slowness in creating the chart, it is also (very) slow to change sizes etc.
Any advice for a heavily annotated chart?
- NetTecture asked 10 years ago
Hi.
I am evaluating the SciChart control – so far it looks very promising.
I have a FastHeatMapRenderableSeries that is analyzed and a FastLineRenderableSeries line is drawn through the chart.
The user needs to be able to correct the analysis, and this is done by “drawing” in the heatmap.
As far as I could tell, the ChartModifierBase gives med the necessary hooks to track the user’s mouse movements – but I would like to give some visual feedback by changing the cursor, for instance to Cursors.Pen (Cursors from the Microsoft namespace)
Is this possible? I would want to enable drawing when user presses Ctrl, the disable it when user releases Ctrl…
- Espen Albrektsen asked 6 years ago
- last active 6 years ago
Please help to provide a tutorial example to implement IThemeProvider interface in order to make a custom theme.
Thanks,
Tanmay
- Tanmay Gupta asked 9 years ago
- last active 9 years ago
Hi,
I have some XyDataSeries<DateTime, double> showing some data on my chart. Also I have 2 vertical line annotations (red and blue) where I know the two DateTime values.
Is there a effective way to get the double values between this range of each XyDataSeries.
Regarrds Markus
- Rupertsberger Markus asked 9 years ago
- last active 9 years ago
Hello,
I have a SciChart with multiple y-axes. Thanks to the ZoomPanModifier the user can pan the whole chart by dragging (holding the left mouse button down and moving the mouse). Good! But it should also be possible for the user to pan a certain axis (meaning : changing the min and max values of the axis) and that doesn’t seem to be possible with the built-in ChartModifiers.
So then I thought, no problem, I make my own ChartModifier to handle this (I already implemented two other modifiers for other mouse interactions before, so I get the hang of this :-)). But I don’t get this to work correctly.
My first attempt was to derive from ChartModifierBase and then handle events like OnModifierMouseDown and OnModifierMouseUp. Problem there is that OnModifierMouseUp doesn’t get called when the mouse is not over the chart surface anymore. That is a problem because the user can release the mouse button when the mouse is over another part of the WPF window or even outside of the application window and somewhere else on the screen.
My second attempt was to inherit from ZoomPanModifierBase because the ZoomPanModifier handles these ‘mouseups’ correctly. I try by overriding the Pan(System.Windows.Point currentPoint, System.Windows.Point lastPoint, System.Windows.Point startPoint) method but this method only gets called when the panning starts on the chart area itself, not on one of the axes, so it doesn’t seem to be a solution either.
public class AxisPanModifier : ZoomPanModifierBase
{
public override void Pan(System.Windows.Point currentPoint, System.Windows.Point lastPoint, System.Windows.Point startPoint) {
// Does not get called when the dragging starts on an axis.
}
}
Can someone give me a tip on how to proceed or does someone already have a solution for this ? Thanks for any help in advance. 🙂
Best greetings,
Stefaan
- srillaert asked 9 years ago
- last active 9 years ago
Hi,
When we have 9 horizontal gridlines, we would also like to see 9 yvalues.
Is it possible to also show 300 and -500 on Yaxis1 and 500 and -300 on Yaxis2
(see attachment)
Thanks and best regards,
Egbert
- EJansen asked 9 years ago
Can you please provide some examples of how to alter the formatting of a DateTimeAxis axis. I’d like to show the date and the time component that also supports localization based on the user regional settings.
- sdemooy asked 11 years ago
The issue I’m dealing with is that after setting up the SeriesSelectionModifier, I require a double-click (and a very, very precise double click, at that) to select a series. Naturally, this is also competing with the ZoomExtents() call that is the normal effect of a doubleclick.
<!-- Chart --> <scichart:SciChartSurface Grid.Column="1" Grid.Row="1" x:Name="sciChartSurface" SeriesSource="{Binding SeriesList, Mode=OneWay}" ChartTitle="{Binding Title}" > <scichart:SciChartSurface.XAxis> <scichart:NumericAxis x:Name="AxisX" Id="AxisX" AxisTitle="{Binding XTitle}" AxisAlignment="Bottom" /> </scichart:SciChartSurface.XAxis> <scichart:SciChartSurface.YAxes> <scichart:NumericAxis x:Name="AxisY1" Id="AxisY1" AxisTitle="{Binding Y1Title}" AxisAlignment="Left" /> <scichart:NumericAxis x:Name="AxisY2" Id="AxisY2" AxisTitle="{Binding Y2Title}" AxisAlignment="Right" IsEnabled="{Binding ShowY2Axis}" Visibility="{Binding RelativeSource={RelativeSource Self}, Path=IsEnabled, Converter={StaticResource convBooleanToVisibility}}" /> </scichart:SciChartSurface.YAxes> <!-- Modifiers --> <scichart:SciChartSurface.ChartModifier> <scichart:ModifierGroup> <!-- TODO: Comment --> <scichart:ZoomPanModifier ExecuteOn="MouseRightButton" /> <!-- TODO: Comment --> <scichart:RubberBandXyZoomModifier IsEnabled="True" x:Name="rubberBandZoomModifier" IsXAxisOnly="False" ZoomExtentsY="False" IsAnimated="True"/> <!-- TODO: Comment --> <!--<scichart:RolloverModifier x:Name="rolloverModifier" DrawVerticalLine="False" UseInterpolation="True" SourceMode="AllSeries" />--> <!-- TODO: Comment --> <scichart:CursorModifier x:Name="cursorModifer" SourceMode="AllSeries" UseInterpolation="True"/> <!-- TODO: Comment--> <scichart:ZoomExtentsModifier /> <!-- Exposes a LegendData property (of type ChartDataObject) which can be accesed via elementName from another control --> <!-- ChartDataObject exposes a list of SeriesInfo --> <scichart:LegendModifier x:Name="legend" GetLegendDataFor="AllSeries"/> <!-- Provides selection of series and custom styling options (to the selected series) --> <scichart:SeriesSelectionModifier SelectedSeriesStyle="{StaticResource selectedSeriesStyle}" ExecuteOn="MouseLeftButton" /> </scichart:ModifierGroup> </scichart:SciChartSurface.ChartModifier> </scichart:SciChartSurface>
- dsantimore asked 10 years ago
I have got a CustomTextAnnotation like in this example CustomTextAnnotation
I added a Rendertransform like this.
<s:TextAnnotation.RenderTransform>
<RotateTransform Angle="90"/>
</s:TextAnnotation.RenderTransform>
But the AnchorPoint is not used as rotation center.
I thought of using ToCoordinate() but need a calculator for that which is not available within CustomTextAnnotation.
What is best practice to achive the requested rotation in sciChart?
- Bürger Martin asked 9 years ago
- last active 9 years ago
Hi,
I have a chart showing data sets composed of multiple renderable series. Each data set is displayed using one FastLineRenderableSeries and three XyScatterRenderableSeries. All four series show in the legend for each data set, but I would only like to show the FastLineRenderableSeries in the legend for each data set. How can I do this?
I’ve seen the legendModifier.GetLegendDataFor property, but that can only be set to show options from this enum
public enum SourceMode
{
AllSeries = 0,
AllVisibleSeries = 1,
SelectedSeries = 2,
UnselectedSeries = 3,
}
which aren’t what I need. Some kind of flag on the renderable series saying whether they should be shown in the legend, or some way to specify the items source for the legend would be good.
Thanks!
- Robert Evans asked 8 years ago
- last active 6 years ago
I have a realtime linear chart with multiple x/y axes. When I am zooming the surface, I am changing the X/Y AutoRange mode from AutoRange.Always to AutoRange.Never, which allows me to have Modifiers zooming and panning on a realtime AutoRange chart.
After, I want to re-enable AutoRange when ZoomExtents (double click) occurs.
See below:
public class ZoomExtentsXAxesModifier : ZoomExtentsModifier { private Point _startPoint; private bool _isMouseDoubleClick; public override void OnModifierMouseDown(ModifierMouseArgs e) { base.OnModifierMouseDown(e); if(e.Modifier == MouseModifier.Ctrl) return; if (e.MouseButtons == MouseButtons.Left) _startPoint = e.MousePoint; _isMouseDoubleClick = false; } public override void OnModifierMouseUp(ModifierMouseArgs e) { base.OnModifierMouseUp(e); if (e.Modifier == MouseModifier.Ctrl) return; if (e.MouseButtons != MouseButtons.Left || _startPoint == e.MousePoint || _isMouseDoubleClick) return; using (ParentSurface.SuspendUpdates()) { foreach (var axise in XAxes.Where(axise => axise.AutoRange != AutoRange.Never)) { axise.AutoRange = AutoRange.Never; axise.Zoom(_startPoint.X, e.MousePoint.X); } foreach (var axise in YAxes.Where(axise => axise.AutoRange != AutoRange.Never)) { axise.AutoRange = AutoRange.Never; axise.Zoom(_startPoint.Y, e.MousePoint.Y); } } } public override void OnModifierDoubleClick(ModifierMouseArgs e) { base.OnModifierDoubleClick(e); if (e.Modifier == MouseModifier.Ctrl) return; foreach (var axise in XAxes) axise.AutoRange = AutoRange.Always; foreach (var axise in YAxes) axise.AutoRange = AutoRange.Always; _isMouseDoubleClick = true; } }
For the one chart it is working ok, but when I have more then 2 charts, it is zooming incorect? What can I solve this? I need to recieve one event, when user is zooming, panning or resizing chart. Is it possible?
Thanks,
Arthur
- Arthur Romanov asked 9 years ago
I’m trying to dynamically create chart surfaces and renderable series, but I’m having trouble binding one of the axes to another one, like you would do with this code in XAML:
<s:CategoryDateTimeAxis VisibleRange="{Binding ElementName=priceChart,
Path=XAxis.VisibleRange,
Mode=TwoWay}" />
I need to accomplish the same thing directly in C# but there are no methods related to binding at all. From the MSDN reference pages I’ve seen that any element that extends FrameworkElement has the Binding property, but it seems the axes don’t extend from that.
Could someone help me out in binding this axis to another axis (for the record, the other one is defined in XAML)?
- Sam Stenvall asked 9 years ago
- last active 9 years ago