Hello,
Is there a way to change the font style in TextAnnotations to italics? I would like the user to be able to change the text style using a context menu. I can easily override the FontWeight, FontSize, and FontFamily properties, but there is no FontStyle in the documentation.
Regards,
Kamil
- Kamil Macura asked 2 weeks ago
- last active 2 weeks ago
Hello,
We are creating a stock chart and are currently at the stage of adding various formations. So far, we have added: trend line (LineAnnotation), vertical and horizontal lines, and a horizontal ray (HorizontalLineAnnotation with x1). We still need the most popular and commonly used formation: the extended line – which is simply a straight line that extends across the entire chart, and its position and angles can be adjusted.
Here’s a link with an example of how it works: https://docs.anychart.com/Stock_Charts/Drawing_Tools_and_Annotations/Infinite_Line
Is it possible to create such a line, or is it currently not supported?
Additionally, the ability to add labels only works in HorizontalLineAnnotation and VerticalLineAnnotation. Will the ability to add labels in LineAnnotation be added?
Best regards,
Kamil
- Kamil Macura asked 4 weeks ago
- last active 4 weeks ago
Hello everyone,
I’m trying to display a tooltip when I hover over an annotation in our WPF project using MVVM.
I attempted to override the MouseMove event on the SciChart surface to identify which annotation the mouse was over by cycling through each annotation. However, it didn’t seem like a very good way to proceed to me and I didn’t try to display the desired information at that point.
While reviewing the documentation, I noticed that annotations have a “Cursor” property. Is there a way to bind that property from the viewmodel? That would make my job so much easier.
If anyone has suggestions on how to proceed, they would be greatly appreciated.
Thanks,
Andrea
- Andrea Cerfogli asked 1 month ago
- last active 3 weeks ago
Hello,
I am using your example:
https://www.scichart.com/documentation/js/current/CursorModifier_CustomisingContainer.html
new CursorModifier({
showYLine: false,
axisLabelFill: "#484848",
tooltipLegendOffsetX: 10, - doesn't work
crosshairStrokeDashArray: [5, 5],
crosshairStrokeThickness: 1,
crosshairStroke: _theme.crosshairStrokeSupplyDemand,
showTooltip: true,
tooltipSvgTemplate: getTooltipSvgTemplate
})
Is it possible to offset the tooltip from the X-axis? If it is on the right side of the axis, the spacing is maintained, unfortunately, if it is on the left side, it is ‘stuck’ to the line.
Thanks in advance.
Best regards,
Kamil
- Kamil Macura asked 1 month ago
- last active 1 month ago
Hello,
We are developing an application whose main task is to display charts and allow users to add indicators to these charts. We have two requirements for drawing lines on the chart upon button click:
Option 1 (2 clicks):
– The user clicks on point A.
– The user moves the cursor over the chart and sees a line from point A to
the cursor (the line changes length with each mouse movement).
– On the second click, the line takes on the final parameters of the
second click.
Option 2 (mousedown && mouseup ):
- I press the mouse on point A but do not release it.
- I move the cursor over the chart (the line changes length with each mouse movement).
- I release the mouse, and the line is drawn.
Is either of these options feasible? If not, is there any possibility of drawing lines through any user interaction?
At the moment, we have implemented line drawing by clicking on a point, and at that point, a short line is drawn that the user can adjust as they wish. However, there is a minor issue with retrieving the X and Y values:
const mouseX = clickEvent.offsetX;
const mouseY = clickEvent.offsetY;
const xValue = this.sciChartSurface.xAxes.get(0).getCurrentCoordinateCalculator().getDataValue(mouseX);
const yValue = this.sciChartSurface.yAxes.get(0).getCurrentCoordinateCalculator().getDataValue(mouseY);
These values are always shifted to the right and downward. Is there any additional trick I should use to fix it?
Thanks in advance.
Best regards,
Kamil
Link to chart: https://ibb.co/fnG9NV8
- Kamil Macura asked 2 months ago
- last active 3 weeks ago
Hello.
I have real-time chart. It updates and X-axis always moving. When I added annotation like VerticalLineAnnotationViewModel to chart I choose the certain point on X-axis and after adding annotation it start moving with X-axis. It is OK.
But now I need to add VerticalLineAnnotationViewModel with calculated point on X-axis. I will be looks like constant static vertical line on moving chart. Can I make something like this?
- Fedor Iudin asked 3 months ago
- last active 3 months ago
Hi,
ich would like to draw annotations for min/max-prices on a chart like the attached image. I got pretty close to the screen but I have two questions:
1. is there a way to automatically such min/-max-annoations (currently I determine min and max values manually and then draw the annotation at the respective x/y coordinates)
2. How can I make sure those annotations are visisble; currently I use growBy(0.1, 0.1) on each axis to have some room for the labels, but that seems pretty unreliable.
Regards
Benjamin
- Benjamin Mesing asked 4 months ago
- last active 3 months ago
I’m creating a web application in which I have a little bit over a million data points. When toggling annotations (about 4000) on one of my charts I noticed the memory usage of Chrome was doubled. I did some tinkering and found out this behaviour only occurred when I had “strokeDashArray” set in my VerticalLineAnnotations.
for (let i = 0; i < 5000; i++) {
const line = new VerticalLineAnnotation({
x1: i,
strokeDashArray: [5, 5] //If this is removed then the memory usage drops
});
sciChartSurface.annotations.add(line);
}
Is there a known memory problem with dashed lines or anything I might do wrong?
- Niklas Åkerlind asked 4 months ago
- last active 4 months ago
Hello,
I need to draw a lot of annotations. Those are pretty simple figures/icons. The gotchas:
- The axis (ticks/labels) should be inside of the chart area.
- The annotation should be drawn on the border of the axis/chart.
I started to use the immediate mode for this. Was pretty happy to see there are Layers in the render context and I thought I could schedule or manipulate the rendereings when it comes to what I want. Unfotunately it is immutable.
The first thing I could come over by manipulating the template at runtime although I do not want to re-template it in fear of bigger template changes than the change of Grid.Row
at runtime.
The second part is more tricky now. I would like to have fine grained control over the ordering of what is drawn. At least above/below the RenderableSeries but best to select the layers as wanted.
One big deal I did overcome is some mouse hover action for the drawn annotations.
So my idea now would be to add custom rendering layers like the HighQualityRenderSurface
but I have no Idea how this impacts the performance. I already have a target of ~30 charts. Fortunately visible ones would be only around 8 so I could manipualte the visibility on scroll to prevent render.
I attached an example of the idea.
What I tried before was interfering with The ISciChartRenderer
to wrap a before and after render. The problem is the Services
are registered and the value is asigned to a property so that my re-register (swap) has no effect. Finally I got it working using a IAnnotationsDrawingProvider
wrapper.
You can find the related post on StackOverflow:
https://stackoverflow.com/questions/78436617/immediate-mode-scichart-rendering-with-ordering-and-axis-positioning-custom-fas
EDIT:
For the fine grained control over the rendering order I managed to use the Layers
just need to do it before any counterpart manages to schedule an action (ISciChartRenderer
worked just the base class private variable assignment is nasty).
- [email protected] asked 4 months ago
- last active 3 months ago
I have a design where I want to show something like a box at the top of the chart and when hovering on it, it should show up a tooltip with some info, the issue I’m running into is the fact that I can’t seem to find way I can add tooltip to box annotation other than adding another box annotation when hover or hit, but it seem that it is not recommended base on my previous post before.
I also looked into scatterXY series or pointMarker, the issue with Point marker or scatter series is that I can only set one x and y, but my design require the box to be from a certain x1 point to x2 point. I can probably try to calculate the width and set the width to the point marker, but I would rather not if there is a better way.
Also looked into column chart, but that also have the same issue of only one x and y point and not sure about tooltip, but definitely seem more promising than annotation.
Please let me know if there is a better way to accomplish this, thank you!
The image below is the design.
- Nung Khual asked 7 months ago
- last active 7 months ago
When I put localized text in my annotations, and the user selects a different language while the chart is showing, do I have to rebuild my annotations?
I had hoped that I could register ‘globalized’ texts in my annotation object, and localize them in the getter method, but it seems that the getter method is not called every time the annotation text is displayed in a ToolTip
- Søren Bech Christensen asked 12 months ago
- last active 12 months ago
I need to serialize annotations. Not all the chart properties, but just Annotations.
I’ve tried to serialize the AnnotationCollection, as well as a List and neither works.
- kelias asked 12 months ago
- last active 12 months ago
Hello,
I’ve got Annotations ViewModels collection (BoxAnnotationViewModel, VerticalLineAnnotationViewModel, LineAnnotationViewModel) bound by AnnotationsBinding. Every Annotation ViewModel has properties set to:
CoordinateMode = AnnotationCoordinateMode.Absolute
IsEditable = true
DragDirections = XyDirection.XYDirection
ResizeDirections = XyDirection.XYDirection
My goal is to move and resize every annotation on SciChart surface only by integer value. Is there any way to achieve this?
Best regards,
Anna
- Anna Kozłowska asked 2 years ago
- last active 2 years ago
Hello SciChart-Team,
we had the requirement to show the zero line when there are negative values in the chart.
We noticed the following things, especially in connection with the main grid lines.
There are some side effects at certain sizes of the window:
When the gridlines are on(see screenshot 1):
1. Grid line and tick are not on the same level (Only for certain sizes)
2. The grid line and horizontal annotation line (green) are not aligned either (Only at certain sizes)
3. The axis line (defined via BorderThickness) is also not aligned with the grid line (regardless of the size of the control).And the bottom tick is never aligned with the major grid line
If the major grid lines are switched off, the zero annotation line is not aligned to the ticks for certain sizes of the control (see screenshot 2)
It looks like different algorithms were used to calculate the line position of the ticks, grid lines and line annotations.
The problem was detected on the monitor with 100% scaling. On a 4K monitor with scaling > 100%, the problem became even more apparent
Do you have any suggestion how to solve the problem?
I’ve attached a modified example project in which the behavior can be reproduced.
Regards
Silvester Schneidt
- Silvester Schneidt asked 2 years ago
- last active 11 months ago
Is there a way to draw an svg formatted annotation onto a chart for WPF?
I have found references/examples for it in javascript here . . .
https://www.scichart.com/documentation/js/current/Tutorial%2006%20-%20Adding%20Annotations.html
but not for any other platform.
- Russell Hall asked 2 years ago
- last active 2 years ago
I have a strange margin in the end of the chart. But AxisMarkerAnnotations don’t have this margin. Only series and HorizontalLineAnnotation. Look at the picture:
Where did it come from?
And maybe I can add margins to max and mix values?
- Iliya Mashin asked 2 years ago
- last active 2 years ago
I’m using a chart as a way to visualise a series of time-based tasks on a “timeline”, not unlike a Gantt chart (is there anything SciChart can’t be used for?!). I do this using annotations that the user can move and resize, actually custom “box” annotations that can only be dragged and resized horizontally. Image attached if interested.
When a user starts moving or resizing an annotation, I bring it to the front to ensure that it remains visible even if it ends up overlapping another annotation, using:
Panel.SetZIndex(annotation, Int.MaxValue);
For every other annotation
Panel.SetZIndex(annotation, 0);
Finding this approach was a bit of a happy accident so I’m wary of continuing to use this technique in case it breaks in a future version. I’m assuming this code works because annotations reside in a parent container that inherits from Panel? Do you see any issues using the above or is there a “better” way to change an annotation’s Z-Index?
- Andrew Stephens asked 3 years ago
- last active 1 year ago
Greetings!
I am interested in drawing lines segments/cylinders on a WPF 3D plot in a manner that allows them to be selected or allow hit testing. I have looked at:
1) Selecting a vertex on a SciChart3DSurface, but I need to select the line
2) Drawing CylinderPointMarker3D’s but I need to set the length of each one
These lines only need to be drawn in the XY, XZ, and YZ planes so I have thought about using the ImpulseRenderableSeries3D but I need to control where the line segments start and end – and this doesn’t look like it allows control of the start.
Any ideas?
–Jonathan
- Jonathan Trumbull asked 3 years ago
- last active 3 years ago
Hi,
Can you please tell me how to change selection points of annotation?
Thanks in advance.
Regards,
Batyr
- Batyr Batyr asked 3 years ago
- last active 3 years ago
I downloaded the SciChartTeam SciChart version 6.4.0.13633 release from Git , thinking I would be able to get myself educated regarding Composite Annotations , which is something that has been requested by our field engineers.
The reference however given in the xaml file gives me :
Resources/ExampleSourceFiles/AnnotateAChart/CompositeAnnotations/CompositeAnnotationsView.xaml.txt
within the solution. That reference does not include any source files (see attached image)
Since Composite Annotations is fairly complex, code examples and a working example solution, showing Composite Annotations implemented would be extremely helpful for me. Is there a running example I can download / view/ interact with ?
Appreciate support in this matter
Thank you
Anders
- John-Anders Persson asked 3 years ago
- last active 3 years ago
Hi,
I’m trying to add a small image as an annotation to the chart, but I couldn’t make it work… most likely doing something wrong, but I can’t quite figure out how this should be done. This is the direction I went for:
public void AddIcon()
{
Image image = new Image();
BitmapImage icon= new BitmapImage();
icon.UriSource = new Uri(@"D:\icon.png", UriKind.Absolute);
image.Source = icon;
var annotation = new CustomAnnotation()
{
X1 = 0,
Y1 = 0,
Content = image,
};
ChartAnnotations.Add(annotation);
}
What am I doing wrong? is there a proper and simple way to add image annotations to the chart in an MVVM manner?
Thank you!
- Ilan Rozen asked 4 years ago
- last active 1 year ago
Hi,
I am currently adding a Vertical Slice Modifier with just on Vertical Line inside of it.
The idea is to create a vertical cursor to display Y values for a given X value.
As my chart is a real time chart, I don’t want my cursor position changed expect on user interaction, I set to Relative the CoordinateMode property of my Annotation.
<s:VerticalSliceModifier Name="sliceModifier" ShowTooltipOn="Always" IsEnabled="True">
<s:VerticalSliceModifier.VerticalLines>
<s:VerticalLineAnnotation IsEditable="True" X1="0.5" Stroke="#D62D15" CoordinateMode="Relative"/>
</s:VerticalSliceModifier.VerticalLines>
</s:VerticalSliceModifier>
The vertical line is correctly displayed at the centre of the surface but point markers and tooltips are not displayed at the line position, it seems the relative coordinate mode is not handle on this area.
Thanks for your help
Jean-Charles
- Jean-Charles DURAND asked 4 years ago
- last active 4 years ago
I have created a composite annotation that consists of four elements: two VerticalLineAnnotations, a BoxAnnotation, and a TextAnnotation. When I first add the annotation, everything appears correctly. However, when I change between tabs in my TabControl… the BoxAnnotation disappears. The box will reappear when I move the composite annotation a few pixels.
Note: Calling ZoomExtents() or InvalidateElement() does not fix the issue.
I’ve created a simple app to reproduce the issue.
PeakAnnotation.xaml
<s:CompositeAnnotation x:Class="WpfPresentation.Views.PeakAnnotation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="http://schemas.abtsoftware.co.uk/scichart"
Canvas.ZIndex="1"
DragDirections="XDirection"
ResizeDirections="XDirection"
IsEditable="True">
<s:CompositeAnnotation.Annotations>
<s:VerticalLineAnnotation CoordinateMode="Relative" Stroke="#FFBADAFF" StrokeThickness="2" X1="0" X2="0" Y1="0" Y2="1"/>
<s:VerticalLineAnnotation CoordinateMode="Relative" Stroke="#FFBADAFF" StrokeThickness="2" X1="1" X2="1" Y1="0" Y2="1"/>
<s:BoxAnnotation x:Name="box" Opacity="0.2" CornerRadius="2" Background="#FFBADAFF" BorderBrush="#1964FF" CoordinateMode="Relative" X1="0" X2="1" Y1="0" Y2="1"/>
<s:TextAnnotation x:Name="AnnotationTextLabel" CoordinateMode="Relative" X1="0" Y1="0.95" FontSize="12" Foreground="White"/>
</s:CompositeAnnotation.Annotations>
PeakAnnotation.xaml.cs
public partial class PeakAnnotation : CompositeAnnotation
{
public PeakAnnotation()
{
}
public PeakAnnotation(string annotationText)
{
InitializeComponent();
AnnotationTextLabel.Text = annotationText;
}
public string StyleKey { get; set; }
public Type ViewType => throw new NotImplementedException();
}
MainViewModel.cs
public MainViewModel()
{
ChartTitle = "Testing";
Annotations = new AnnotationCollection();
var myAnnotation = new PeakAnnotation("My Annotation Title")
{
X1 = 40,
X2 = 50,
Y1 = 0,
Y2 = 100
};
Annotations.Add(myAnnotation);
}
public string ChartTitle { get; set; }
public AnnotationCollection Annotations { get; set; }
}
MainWindow.xaml
<Window x:Class="SciChartTesting.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SciChartTesting" xmlns:s="http://schemas.abtsoftware.co.uk/scichart"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Window.Resources>
<local:MainViewModel x:Key="MainViewModel"/>
</Window.Resources>
<Grid DataContext="{StaticResource MainViewModel}">
<TabControl>
<TabItem Header="TabOne">
<Label Content="This is TabOne"/>
</TabItem>
<TabItem Header="TabTwo">
<s:SciChartSurface ChartTitle="{Binding ChartTitle}" Annotations="{Binding Annotations}">
<s:SciChartSurface.XAxis>
<s:NumericAxis VisibleRange="0,100"/>
</s:SciChartSurface.XAxis>
<s:SciChartSurface.YAxis>
<s:NumericAxis VisibleRange="0,100"/>
</s:SciChartSurface.YAxis>
</s:SciChartSurface>
</TabItem>
</TabControl>
</Grid>
- Kyle Williamson asked 4 years ago
- last active 4 years ago
Hello Everyone,
I have set up a few annotations in my project and set their visibility to hidden.
I am displaying only the selected one from a combobox I have set up for the user.
But each time the chart does ZoomExtents. all the annotations appear and their visibility resets to visible.
Is this intentional?
Can I disable this option?
Thank you in advance.
- Mehmed Kumali asked 4 years ago
- last active 4 years ago
I create a real time chart and want to add line annotation which help to user to understand chart wave form.
However I can’t add fix position of annotation. I change annotation every time chart is update but the annotation is not fixed in one position. The x value is datetime axis and the visible range is 5 second. Data is added around 100 data per second.
- トー カウン asked 4 years ago
To whom this may concern:
I am following up to an issue that I posted a few years ago: https://www.scichart.com/questions/wpf/resizing-custom-annotations
I’ve attached a sample project that outlines what I am trying to accomplish. It is a simple scatter chart with randomized points in which I am trying to draw a rotatable ellipse annotation around the points.
The annotation inherits the “BoxAnnotation” class and replaces it’s template with an ellipse that is shaped to within the bounds of the annotation. This ellipse can be rotated by dragging the ellipse with the right-click button of the mouse. Upon doing so, in order to ensure the ellipse still maintains its shape when zooming in, the ellipse is converted to a geometric path. (Shown when the color of the ellipse changes from red to green.) Like this, when re-sizing the ellipse, it maintains its shape. After re-sizing, if the user wants to rotate the ellipse again, the original Ellipse UIElement re-surfaces and the Path UIElement is hidden. The user can then rotate the ellipse, which is in turn rendered back to a Path UIElement once again. The bounds of the annotation are modified to ensure the ellipse and its geometric path maintains its shape when switching between the Ellipse and the Path UIElements.
The issue is when re-sizing the annotation, and then attempting to rotate the ellipse again, the ellipse is clipped by the bounds of the annotation, even though “ClipToBounds” is set to false (in the code-behind). Unfortunately, I can’t find a pattern for which this occurs, and I have no solution to this issue. Examples of the clipped and non-clipped ellipses are shown in the attached images.
Hopefully the attached project is easy to understand. Can you please advise?
Thank you kindly!
— Ari
EDIT: Code attached as .ZIP file
- Ari Sagiv asked 5 years ago
- last active 5 years ago
Hi,
I’m trying to follow the instructions here: https://www.scichart.com/documentation/v5.x/Tutorial%2007%20-%20Adding%20Annotations.html
to create a subclass of CustomAnnotation. I have copied the attributes given in the example (VerticalAnchorPoint=”Bottom” HorizontalAnchorPoint=”Center”) but I still get the error “An attribute name is missing” on anything I put after the attributes. Are there other attributes that may be required for CustomAnnotation, not given in this example?
Thanks,
Rachel
- Rachel Myrah asked 5 years ago
- last active 5 years ago
Hi,
I would like to know if there’s a way to show a list of Annotations for which the coordinates are stored in lists in my c# code. I can bind the items in the lists like this:
s:SciChartSurface.Annotations …>
s:CustomAnnotation X1=”{Binding XList[0]}” Y1=”{Binding YList[0]}” …/>
s:CustomAnnotation X1=”{Binding XList[1]}” Y1=”{Binding YList[1]}” …/>
s:CustomAnnotation X1=”{Binding XList[2]}” Y1=”{Binding YList[2]}” …/>
s:CustomAnnotation X1=”{Binding XList[3]}” Y1=”{Binding YList[3]}” …/>
/s:SciChartSurface.Annotations …>
Is there a way to do this with something like ItemsControl?
Thanks,
Rachel
- Rachel Myrah asked 5 years ago
- last active 5 years ago
When I enter PathAnnotation in the xaml, I get the error “The type ‘s:PathAnnotation’ was not found.” I do have the following Annotation types available:
– AxisMarkerAnnotation
– BoxAnnotation
– CustomAnnotation
– HorizontalLineAnnotation
– LineAnnotation
– LineArrowAnnotation
– SeriesValueAxisMarkerAnnotation
– TextAnnotation
– VerticalLineAnnotation
I want to be able to make a star shape annotation, and PathAnnotation seemed to be the only way to do this. Please let me know if there’s another way to do this.
Thanks,
Rachel
- Rachel Myrah asked 5 years ago
- last active 5 years ago
I need to update a lot of annotations. Not so much. Remove and add about 10-100 annotations per action. And it takes a lot of time. I’ve already tried all the recommendations with SusppendUpdates etc, but the result is the same.
I don’t need the flexibility of UIElements. I’m using it as markers only.
So, maybe it is possible to implement annotations as a series with a custom point marker. I need a vertical dashed line with text, like in screenshot. Is there a way to do it?
- Alexander Erkabaev asked 5 years ago
- last active 5 years ago
I am placing annotations at the top of every bar in a stacked bar graph (and a standard bar graph on another screen) showing the total of all the stacked bars by iterating through my data, generating the sum, and placing it at the correct x,y (an incredibly manual process that seems like there should be much easier to do but I found no other way to do it – if there is a better way, I would love to hear it, but that’s a secondary issue and not my current problem).
I also have a legend where the user can select / deselect series.
When the user selects/deselects a series from the legend, I need to hide all my annotations and then recreate them because the sums of the stacked bars has changed (or if no bars are showing, remove my annotation completely). My assumption is I could reiterate through my data and check series to see if they are visible (isVisible) and recalculate the sums and recreate the annotations (another very manual process but I can probably work it out).
My primary problem is I see no way for me to intercept that this legend event occurred. The series get hidden internally and I never have a chance to do anything with the annotations. It seems like this may be doable on other platforms but I’m at a loss on iOS. There is no delegate / block event handler / etc.
Any thoughts?
- Rich Wardwell asked 6 years ago
- last active 6 years ago
Hi.
I am using BoxAnnotation in my project. When IsEditable attribute is set to true, there are four resizing grips available on the corners of the box.
The problem is that these grips are only visible when we click on the BoxAnnotation. I couldn’t find any available property to permanently display those resizing grips.
You can view this behavior in the Interaction With Annotations example.
Looking forward to a solution.
Thanks.
- Ali asked 6 years ago
When showing a new view, there are some annotations (from an AnnotationCollection) on the panel, but the RenderableSeries is empty. Is it possible to use the scrollbar to zoom in details of annotations?
- yi zheng asked 6 years ago
- last active 6 years ago
Is it possible to scale annotations? I’ve included a couple screenshots. The first is our old, ugly legacy chart. The next few are SciChart. One challenge we have is to place labels on a chart at different locations relative to specific locations on the series. They need to be annotations that the user DOES NOT have permission to edit before he saves the chart to a PNG.
The purple and red lines on my chart look exceptional and “scale” correctly because their XY values scale as the chart is resized matching the series as it scales.
The red, purple and orange annotations however do not. I understand why it’s happening as I’m placing the annotations at exact locations via XY. So as I magnify or resize the window the XY doesn’t change; however, the original location of my annotation “appears to the user” to move. I understand that it’s not really moving as it is still located at the same exact XY where it was placed.
Is there a simpler way to scale it to a relative position during a window resize? Or am I stuck having to redraw the annotations as this happens?
- Chris Kirkman asked 6 years ago
- last active 6 years ago
Hi,
CompositeAnnotation works perfectly and easy to use, but I need it in MVVM. CompositeAnnotationViewModel looks the same, but it is not visible. This is my code:
AnnotationViewModels.Add(new CompositeAnnotationViewModel()
{
Annotations = new ObservableCollection<IAnnotationViewModel>()
{
new VerticalLineAnnotationViewModel
{
VerticalAlignment = VerticalAlignment.Stretch,
Stroke = Colors.Blue,
StrokeThickness = 2,
IsEditable = true,
StrokeDashArray = new DoubleCollection() { 2, 2 },
CoordinateMode = AnnotationCoordinateMode.Relative,
X1 = 0
},
new VerticalLineAnnotationViewModel
{
VerticalAlignment = VerticalAlignment.Stretch,
Stroke = Colors.Blue,
StrokeThickness = 2,
IsEditable = true,
StrokeDashArray = new DoubleCollection() { 2, 2 },
CoordinateMode = AnnotationCoordinateMode.Relative,
X1 = 1
}
},
IsEditable = true,
X1 = 3,
X2 = 5
});
What is my mistake?
- Alexander Erkabaev asked 6 years ago
- last active 6 years ago
Hello
I’m working on a WPF app. Everything is OK except that I don’t understand how to render the series above the annotations.
The XAML code is the following:
<s:SciChartSurface Name="sciChartSurface"
s:ThemeManager.Theme="SciChartv4Dark"
Annotations="{Binding Path=Annotations}"
ChartTitle="{Binding Path=GraphTitle}"
DataContext="{Binding Path=ChartViewModel,
RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type charts:ChartView}}}"
FocusVisualStyle="{x:Null}"
Focusable="True"
SeriesSource="{Binding Path=Series}"
Padding="0 5 8 0">
<s:SciChartSurface.RenderSurface>
<s:HighQualityRenderSurface/>
</s:SciChartSurface.RenderSurface>
<s:SciChartSurface.ChartModifier>
<s:ModifierGroup>
[...]
</s:ModifierGroup>
</s:SciChartSurface.ChartModifier>
<!-- Create an X Axis -->
<s:SciChartSurface.XAxis>
<s:NumericAxis AutoRange="{Binding Path=XAxis.AutoScaling,
Converter={StaticResource BooleanToAutoRangeConverter}}"
AxisTitle="{Binding Path=XAxis.AxisTitle}"
DrawMajorGridLines="{Binding Path=XAxis.ShowGridLines}"
DrawMinorGridLines="False"
DrawMinorTicks="True"
GrowBy="0, 0.1"
AxisBandsFill="#1c1c1e"
VisibleRange="{Binding Path=XAxis.AxisRange,
Mode=TwoWay}"
MajorDelta="{Binding XAxis.MajorDelta, Mode=TwoWay}"
MinorDelta="{Binding XAxis.MinorDelta, Mode=TwoWay}"
AutoTicks="{Binding XAxis.AutoTicks}"
/>
</s:SciChartSurface.XAxis>
<!-- Create a Y Axis -->
<s:SciChartSurface.YAxis>
<s:NumericAxis AutoRange="{Binding Path=YAxis.AutoScaling,
Converter={StaticResource BooleanToAutoRangeConverter}}"
AxisAlignment="Left"
AxisTitle="{Binding Path=YAxis.AxisTitle}"
DrawMajorGridLines="{Binding Path=YAxis.ShowGridLines}"
DrawMinorGridLines="False"
DrawMinorTicks="True"
GrowBy="0.1, 0.1"
IsPrimaryAxis="True"
AxisBandsFill="#1c1c1e"
VisibleRange="{Binding Path=YAxis.AxisRange,
Mode=TwoWay}"
MajorDelta="{Binding YAxis.MajorDelta, Mode=TwoWay}"
MinorDelta="{Binding YAxis.MinorDelta, Mode=TwoWay}"
AutoTicks="{Binding YAxis.AutoTicks}"
/>
</s:SciChartSurface.YAxis>
</s:SciChartSurface>
Edit: this is the code that creates the horizontal annotation:
/// <summary>
/// Creates a chart annotation
/// </summary>
/// <param name="a"></param>
/// <returns></returns>
private AnnotationBase CreateChartAnnotation(Annotation a)
{
HorizontalLineAnnotation annotation;
//not used??
//ColorToBrushConverter brushConverter = new ColorToBrushConverter();
annotation = new HorizontalLineAnnotation() { Y1 = a.ThresholdValue.Value };
annotation.Stroke = new SolidColorBrush((Color)ColorConverter.ConvertFromString(a.Stroke));
annotation.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
annotation.IsEditable = false;
annotation.LabelTextFormatting = string.Format("{0} 0.0", a.Label);
annotation.StrokeThickness = 2;
annotation.LabelPlacement = LabelPlacement.Axis;
annotation.ShowLabel = a.ShowLabel;
if (a.DashArray != null)
{
annotation.StrokeDashArray = new DoubleCollection(a.DashArray);
}
return annotation;
}
I tried to set AnnotationCanvas.BelowChart but the behaviour is very strange: the horizontal annotation line is no more continuous
I attached two jpegs
Regards
Gianpaolo
- gianpaolo filippa asked 6 years ago
- last active 6 years ago
Greetings, I wonder if is it any way to save the annotations that I do in the charts?
Because when I leave the chart the annotations gone.
- Kevin Rodriguez asked 6 years ago
- last active 6 years ago
I’ve been pouring through the documentation and examples and cannot find an example of this. Has anyone been able to accomplish this and willing to share an example? Thanks.
- Clifford Bateman asked 7 years ago
I am trying to integrate custom symbols from AnnotationsAreEasyFragment to MultiPaneStockChartsFragment but the symbols are not visible on price chart of MultiPane… can anyone please help me out with how to give X and Y axis in multipane price chart
- Ghousia Begum asked 7 years ago
- last active 7 years ago
I add a LineAnnotation programmaticly to my surface and want to readjust it just like in the Examples Suite via clicking and draging the ends of the annotation.
As long as i dont use a Theme everything works fine. But when applying a custom theme the Manipulation points are not there anymore (and not only visualy, clicking at the end of the line also does not work. Furthermore the mousecursor does not change to a cross when hovering above the annotation end).
This is my Custom theme code:
<ResourceDictionary x:Class="Reprocess.SciChartDisplay.CustomTheme"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<!-- ************************* -->
<!-- Colors and Brushes -->
<!-- ************************* -->
<!-- Chart Brushes -->
<SolidColorBrush x:Key="TickTextBrush" Color="Black"/>
<SolidColorBrush x:Key="MajorGridLineBrush" Color="LightGray"/>
<SolidColorBrush x:Key="MinorGridLineBrush" Color="LightGray"/>
<SolidColorBrush x:Key="SciChartBackground" Color="White"/>
<SolidColorBrush x:Key="GridBorderBrush" Color="#102A47"/>
<SolidColorBrush x:Key="GridBackgroundBrush" Color="Transparent"/>
<SolidColorBrush x:Key="RolloverLineBrush" Color="#33FD9F25"/>
<SolidColorBrush x:Key="CursorLineBrush" Color="#996495ED"/>
<SolidColorBrush x:Key="RubberBandFillBrush" Color="#33333399"/>
<SolidColorBrush x:Key="RubberBandStrokeBrush" Color="#77999999"/>
<SolidColorBrush x:Key="LegendBackgroundBrush" Color="AliceBlue"/>
<SolidColorBrush x:Key="LabelBackgroundBrush" Color="#AA6495ED"/>
<SolidColorBrush x:Key="LabelBorderBrush" Color="#FF6495ED"/>
<SolidColorBrush x:Key="LabelForegroundBrush" Color="Black"/>
<SolidColorBrush x:Key="TextAnnotationForeground" Color="#EEEEEE"/>
<SolidColorBrush x:Key="TextAnnotationBackground" Color="#AA6495ED"/>
<Color x:Key="AxisBandsFill">White</Color>
<!-- Default Series Colors -->
<Color x:Key="UpWickColor">Gray</Color>
<Color x:Key="DownWickColor">Gray</Color>
<SolidColorBrush x:Key="UpBodyBrush" Color="Gray"/>
<SolidColorBrush x:Key="DownBodyBrush" Color="Gray"/>
<Color x:Key="UpBandSeriesLineColor">#22117711</Color>
<Color x:Key="DownBandSeriesLineColor">#22111111</Color>
<Color x:Key="UpBandSeriesFillColor">Black</Color>
<Color x:Key="DownBandSeriesFillColor">Red</Color>
<LinearGradientBrush x:Key="MountainAreaBrush" StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="Gray" Offset="0"/>
<GradientStop Color="#000710" Offset="1"/>
</LinearGradientBrush>
<Color x:Key="MountainLineColor">Black</Color>
<Color x:Key="LineSeriesColor">Black</Color>
<Color x:Key="ColumnLineColor">#11FFFFFF</Color>
<SolidColorBrush x:Key="ColumnFillBrush" Color="#11FFFFFF"></SolidColorBrush>
<Brush x:Key="OverviewFillBrush">White</Brush>
<Brush x:Key="ScrollbarViewportBackgroundBrush">White</Brush>
<LinearGradientBrush x:Key="DefaultColorMapBrush">
<GradientStop Offset="0" Color="White"/>
<GradientStop Offset="0.5" Color="White"/>
<GradientStop Offset="1" Color="White"/>
</LinearGradientBrush>
Any suggestions?
- Andre Pols asked 7 years ago
- last active 7 years ago
Hi there.
It’s has been asked here:
https://www.scichart.com/questions/question/custom-annotation
So, Is it possible to draw dashed line annotation at the current version 1.2.3.982?
Best regards,
Sushynski Andrei
- Andrei Sushynski asked 7 years ago
- last active 7 years ago
I am trying to add some annotations to my graph. The problem is that this function is called from a different thread so I get the following excepion:
I thried using an invoke on the main thread but this doesn’t help.
This is the code I use:
var verticalLineAnnotation = new VerticalLineAnnotation
{
X1 = annotation.X,
Tag = annotation,
StrokeThickness = annotation.StrokeThickness,
StrokeDashArray = annotation.StrokeDashArray,
Stroke = annotation.Brush,
ToolTip = annotation.LabelTooltip
};
var referenceDataAnnotation = annotation as ReferenceDataAnnotation;
if (referenceDataAnnotation != null)
{
verticalLineAnnotation.ContextMenu = ChartContextDataTypesFactory.CreateContextMenus(referenceDataAnnotation.Type.Name, Application.Current.MainWindow);
}
if (IsChartFirst)
{
verticalLineAnnotation.AnnotationLabels = new ObservableCollection<AnnotationLabel>
{
new AnnotationLabel
{
LabelPlacement = LabelPlacement.TopLeft,
FontSize = 12,
FontWeight = FontWeights.Normal,
Margin = new Thickness {Bottom = -5},
Text = annotation.LabelText
}
};
}
//This is the line where I get the exception
ParentSurface.Annotations.Add(verticalLineAnnotation);
- Kevin Goos asked 8 years ago
- last active 8 years ago
I am trying to build an application with multiple charts on one screen (3) and each chart annotated with 20-25 annotations.
In total I have 6 FastLineRenderableSeries at once – 2 per chart.
I found serious performance issues after adding more than 10 annotations.
When a user presses a key I go to another set of data. Annotations are created on each data change. I create temporary collection and assign it to the surface annotations collection at once. I also suspend updates through Viewport Manager.
Creation of annotations does not seem to affect the performance, but the rendering of them does.
Most of them are derivatives of AxisMarkerAnnotation and apply a different label template. I tested adding standard Text Annotations instead, just to see whether the custom template had to do something with the performance drop, but it was more or less the same case.
The custom templates are also really simple, it is either a text block or a filled shape, always one component.
Do you have any advises for using a bigger number of annotations?
How to make their rendering faster?
When I remove all annotations the “scrolling” of data goes really smooth.
I am running out of ideas of how to improve.
Best regards,
Paulina
PS Is there any way to try out the other renders before buying a license?
- Paulina Mibenge asked 8 years ago
- last active 8 years ago
Hi;
If I remember good, in a old version of SciChart it was possible to draw custom annotation in chart with a “pen”, like in Paint.
In the current version is it possible? And if yes, how do it please?
Regards;
Damien
- Damien Soudant asked 8 years ago
- last active 8 years ago
Hi,
I’m looking for an annotation that have text and a line or rectangle (like in commix speech balloon) that are anchored to a point on the chart.
Is there such a build in annotation or do I have to build it myself?
- Smadar Tsdaka asked 8 years ago
- last active 8 years ago
Hi all, how i can add annotation on the columns of a chart?
- Paolo Mastrangelo asked 8 years ago
- last active 7 years ago
Hi,
I am working on a live graph similar to the sparse impulse series 3D and would like to add live annotations to the plotted data points to display the Y axis value.
Does the SciChart3DSurface support annotations?
If not I would like to instead use the TooltipModifier3D, but would like to force the tooltip to be displayed all the time and reduce the amount of data displayed to a single Y-Axis value. Does this sound reasonable.
Thanks
Marc
- marc Armstrong asked 8 years ago
- last active 8 years ago
I am building a real-time graph with CategoryDate X Axis and Numeric Y Axis. I found it hard to understand the Annotation API’s regarding the X and Y positions.
Q1:
Looking at AnnotationsAreEasyFragment, it draw a Horizontal line of (seemingly) full width. it declares
sciChartBuilder.newHorizontalLineAnnotation()
.withPosition(7d, 2.8d)
.withStroke(2, ColorUtil.Orange)
.build()
i can under Y = 2.8d, but what is the X=7d for? and in the next Horizontal line which is short, it declares .withPosition(5d, 3.2d)?? X=5d and X=7d gives such a big difference.
Q2:
Since i am using CategoryDateAxis, referring to InteractionWithAnnotationsFragment to draw a vertical line at a specific date/time, there is a short line vertical line on 3rd Dec with the code
sciChartBuilder.newVerticalLineAnnotation()
.withX1(20).withY1(35d).withY2(33d)
...
Since its a date axis, i would expect it to accept a Date.class (or long in millis) instead of .withX1(20). It doesnt even make sense! How exactly do i create full height vertical line at a specific date/time?
- abc def asked 8 years ago
- last active 8 years ago
I have an application for which the VerticalLineAnnotation is a near perfect fit. However, to make it easier to add these annotations from the AnnotationCreatioinModifier, I would like to derive a new annotation class from VerticalLineAnnotation with a couple of new dependency properties, and new label style using these properties. Is this possible? I’ve looked through the forum and existing examples, and can’t find relevant examples. Can you point me in the right direction?
Bill
- William Lear asked 8 years ago
- last active 8 years ago