SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
Hi, I want to color the axis label by its value,
eg.
value < 0 -> show red color
value = 0 -> show gray color
value > 0 -> show green color
similar to this question, but in javascript platform, it seems the LabelProvider has function related to the value(string) formatting only. Is there any ways to styling the label? Thanks!
Hello,
I am trying to set the interval on the x-axis in a polar plot but it doesn’t appear to be accepting it and plotting accordingly. My axis definition is quite simple:
<s:SciChartSurface.XAxis>
<s:PolarXAxis Name="TFxAxis" MajorDelta="15"/>
</s:SciChartSurface.XAxis>
I am plotting angles and radii so one data point might be (45, 1) and the next (50, 2) and so on where my visible range is TFxAxis.VisibleRange = new DoubleRange(-180.0, 180.0). Very simple plot but it keeps returning to a default of 1 on my MajorDelta for the x-axis and then showing major axes at 50 degree intervals. I’ve tried a variety of solutions but nothing seems to work properly.
Thanks,
Christina
Hi there,
I’m trying to display little icons as axis labels using the LabelProvider API and NSAttributedString (with NSTextAttachmet). Is this supported? Here’s a minimal example:
import UIKit
import Foundation
import SciChart
import SciChart.Protected.SCILabelProviderBase
class ViewController: UIViewController {
private lazy var chart: SCIChartSurface = {
let c = SCIChartSurface(frame: .zero)
c.xAxes.add(items: SCINumericAxis())
let yAxis = SCINumericAxis()
yAxis.labelProvider = SymbolLabelProvider()
c.yAxes.add(items: yAxis)
return c
}()
override func viewDidLoad() {
super.viewDidLoad()
SCIChartSurface.setRuntimeLicenseKey(myLicenseKey)
view.addSubview(chart)
chart.translatesAutoresizingMaskIntoConstraints = false
let guide = self.view.safeAreaLayoutGuide
NSLayoutConstraint.activate([
chart.leadingAnchor.constraint(equalTo: guide.leadingAnchor),
chart.trailingAnchor.constraint(equalTo: guide.trailingAnchor),
chart.topAnchor.constraint(equalTo: guide.topAnchor),
chart.bottomAnchor.constraint(equalTo: guide.bottomAnchor),
])
}
}
class SymbolLabelProvider: SCILabelProviderBase<SCINumericAxis> {
lazy var numberFormatter: NumberFormatter = {
let f = NumberFormatter()
f.allowsFloats = true
f.maximumFractionDigits = 2
return f
}()
init() {
super.init(axisType: ISCINumericAxis.self)
}
override func formatLabel(_ dataValue: ISCIComparable!) -> ISCIString! {
let intValue = Int(dataValue.toDouble())
let font = UIFont.init(descriptor: axis.tickLabelStyle.fontDescriptor, size: UIFont.systemFontSize * 4)
if intValue.isMultiple(of: 2) {
let i = UIImage(systemName: "circle", withConfiguration: UIImage.SymbolConfiguration(font: font))
return NSAttributedString(attachment: NSTextAttachment(image: i!))
} else {
let attributes: [NSAttributedString.Key: Any] = [
.font: font,
.foregroundColor: UIColor.yellow,
]
return NSAttributedString(string: numberFormatter.string(for: dataValue.toDouble())!, attributes: attributes)
}
}
}
See attached screenshot for the result.
If this is not supported: any suggestions / ideas for a workaround?
Thanks
—Matthias
I have a few problems that I’m trying to address with y-axis labelling.
This is how I am currently implementing the y-axis:
NumericAxis(context).apply {
drawLabels = true
axisAlignment = AxisAlignment.Left
this.labelProvider = labelProvider
this.tickProvider = tickProvider
drawMajorBands = false
drawMajorTicks = false
drawMinorTicks = false
drawMajorGridLines = false
drawMinorGridLines = false
isLabelCullingEnabled = false
visibleRange = DoubleRange(
dataRange.first,
dataRange.second
)
autoRange = AutoRange.Never
tickLabelStyle = FontStyle(
TypefaceManager.obtainTypeface(context, CustomTypeface.PROXIMA_NOVA_REG),
context.resources.getDimension(R.dimen.results_screen_graph_labels_text_size),
Color.LTGRAY
)
}
Hello. When I try to add to curve some points with very small numbers:
curve.DataSeries = chartData;
chartData.Append(1, -6.525999992441564E-04);
chartData.Append(2, -6.5259999988724722E-04);
chartData.Append(3, -6.52599999843273E-04);
chartData.Append(4, -6.5259999970558607E-04);
chartData.Append(5, -6.5259999978135147E-04);
y axis not shown labels whatever Text Formatting property for this is. What I’m doing wrong? I noticed if I add points with -3 order of value, axis labels will show.
Surface description:
<sc:SciChartSurface>
<sc:SciChartSurface.RenderableSeries>
<sc:FastLineRenderableSeries Name="curve"/>
</sc:SciChartSurface.RenderableSeries>
<sc:SciChartSurface.XAxis>
<sc:NumericAxis/>
</sc:SciChartSurface.XAxis>
<sc:SciChartSurface.YAxis>
<sc:NumericAxis TextFormatting="E3" AutoRange="Always" x:Name="yAxis"/>
</sc:SciChartSurface.YAxis>
</sc:SciChartSurface>
I am using an SCINumericAxis for my y-axis. I am setting the visibleRange to (Min = 28, Max = 76). I am leaving the minorsPerMajor to the default of 5. However when looking at my graph (attached) you can see that the major tick labels are actually every 6 minors, e.g. 30, 36, 42, etc. when they should be 30, 35, 40, etc for minorsPerMajor set to 5.
Please advise on how to fix this issue as my major tick labels should be every 5, not every 6.
I am using the CategoryDateTimeAxis to fetch data in minute resolution for a few days and then append realtime data in one second resolution to it. Since the CategoryDateTimeAxis uses equidistance calculations I was wondering if it is possible to override that behaviour somehow? I.e. can I control the distance calculation somehow?
I am currently switching to CategoryDateTimeAxis because DiscontinuousDateTimeAxis provides to much of a performance hit for our use case.
Hi,
I’m actually working on new wpf application using Scichart and I’m wondering how to plot only XAxis and YAxis without labels and without gridlines.
Here is my code, I cannot not figure out what is missing to do that:
<s:SciChartSurface.YAxis>
<s:NumericAxis VisibleRange="{Binding ...}"
MajorGridLineStyle="{Binding ...}"
TickLabelStyle="{Binding ...}"
MajorDelta="{Binding ...}"
MinorDelta="1"
AutoTicks="False"
AxisAlignment="Left"
DrawMajorGridLines="false
DrawMinorGridLines="false"
DrawMajorBands="false"
DrawMajorTicks="false"
DrawMinorTicks="false"
DrawLabels="false"
</s:SciChartSurface.YAxis>
<Style x:Key="NoGraphGridLineStyle" TargetType="s:NumericAxis">
<Setter Property="Visibility" Value="Collapsed" />
</Style>
Is it possible to set different color to axis ticks and axis title.
In 2D-Chart i did it by changing the style of DefaultTickLabel:
<Style x:Key="NumericAxisForMvvm" TargetType="axis:NumericAxisForMvvm">
<Setter Property="FontSize" Value="12" />
<Setter Property="FontFamily" Value="Arial" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="TickTextBrush" Value="Red" />
<Setter Property="TickLabelStyle">
<Setter.Value>
<Style TargetType="s:DefaultTickLabel">
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontFamily" Value="Courier New" />
<Setter Property="Foreground" Value="Blue" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="s:DefaultTickLabel">
<ContentControl Content="{Binding}"
ContentTemplate="{TemplateBinding ContentTemplate}"
IsTabStop="False"
Foreground="{TemplateBinding Foreground}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
</Style>
Same procedure seems doesn’t work for 3D-Charts.
How can i achieve this?
Is that currently possible?
Best Regards
Silvester
I’m using XyDataSeries<Timespan, double> to plot to my chart.
I want to show elapsed time at chart X-Axis label like below
ex) If Timespan value is 1day 2hour 30min 40sec
Default label style: 02:30:40
Label style I want: 26:30:40
How can I set like that?
This might be a stupid question. 😀 But I tried several things and nothing seems to work…
I have a chart that has several different datasets that can be switched to. When I apply them and do zoom to extents it changes the Y Axis sometimes 1-15, sometimes 1-20, sometimes 1-25. So the chart zooms in/out, which looks nice.
However I would like to fix the initial zoom to be always be 1-20. If the chart is smaller or bigger than 20; that is fine; I just want the initial viewport to always zoom to be 1-20, when I switch the dataset. They can then zoom in/out or pan using gestures.
Any ideas on what API I need to call to zoom the chart to 1-20. (Please note, this is using a logarithmic scale on the Y-Axis — if it makes any differences).
So what do I need to call/set rather than calling the zoom to extents function.
Hi, i’m developing an app in WPF and i found that it crashes when i’m dereferencing the user control where my chart lives in and have 1 or more points selected by code in one chart when the other one is not visible.
i would be very apreciated if someone could tell me a hint of where i have to look for the solution or what do this methods do or touch.
more data about the chart:
this is my Selectionmodifier:
<scicharts:DataPointSelectionModifier
Name="ChartSelection"
SelectionFill="#B1B5B2B2"
XAxisId="{Binding XAxisType, NotifyOnTargetUpdated=True}"
TargetUpdated="ChartSelection_TargetUpdated"
SelectionStroke="#009E9C9C"
IsEnabled="{Binding SelectionMode}" >
I think that this is the axis that breaks my program but it needs it to not crash when i select.
this is my stacktrace:
An unhandled exception of type ‘System.NullReferenceException’ occurred in SciChart.Charting.dll
en SciChart.Charting.ChartModifiers.DataPointSelectionModifier.DeselectAllPointMarkers()
en SciChart.Charting.ChartModifiers.DataPointSelectionModifier.OnXAxisIdDependencyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
I tried to make a program that could replicate the error but i couldn’t.
thanks in advance.
Hello!
I am trying to render a HeatMap and align labels next to squares (see the attached image). However, I am running into two issues.
Firstly, I am using RenderTransform to shift labels so that they are aligned with the squares instead of being on the borders between them. It works, but does not look good as I resize the control.
Second, the axes render the last label outside the view. I tried setting VisualRange and VisualRangeLimit but it did not help. It hides the last data column (or row) and still displays the last label.
Any suggestions on how I can solve it?
I am attaching a sample project.
Thank you in advance!
Hello,
I have the problem, that sometimes only one label is shown on the X-Axis even when there is space to show some more, than only one.
The property “IsLabelCullingEnabled” would show them all, but than it is ugly if there is not enough space.
So what can I do to have some more Labels shown?
In the Screenshots you can see that with only a few pixels more, more labels are shown, but the could have been also shown with less pixels (Especially Label “1” and “22” could have been shown).
Hello,
I am trying to develop a WPF Chart with multiple X and Y Axes. I am able to achieve this perfectly and also I am able to remove a data series using the example available:
But, I am unable to remove the corresponding axes of the series whenever it is removed.
I am using the same logic used to remove a series:
sciChart.XAxes.Remove(sciChart.XAxes.GetAxisById(sampleId));
But, I am unable to get the expected result.
Am I missing something?
How can I apply my style and template to my axes if I created the axes as NumericAxisViewModel in code and bound them to my SciChartSurface in my xaml view?
Regards,
Roland
Hi:
My name is Harold Ramírez and I have a question I would like you to answer because I don’t find any doucmentation about it online.
I have a WPF application with several charts, some of them in 3D. These 3D charts have the X axis in horizontal, Y in vertical and the Z in depth. I want only to keep the labels on the X and Y axis, on the left and bottom of the chart.
The only documentation I have found is this page: https://www.scichart.com/documentation/v5.x/webframe.html#Showing%20Axis%20Labels%20on%20one%20side%20of%20the%203D%20Chart.html, and only shows how to make it in XAML, but I need it to do it programatically in C#.
Thank you for your time.
Harold.
Hi:
My name is Harold Ramírez and I have a question I would like you to answer because I don’t find any doucmentation about it online.
I have a WPF application with several charts, some of them in 3D. These 3D charts have the X axis in horizontal, Y in vertical and the Z in depth. I want only to keep the labels on the X and Y axis, on the left and bottom of the chart.
The only documentation I have found is this page: https://www.scichart.com/documentation/v5.x/webframe.html#Showing%20Axis%20Labels%20on%20one%20side%20of%20the%203D%20Chart.html, and only shows how to make it in XAML, but I need it to do it programatically in C#.
Thank you for your time.
Harold.
Hi support,
I have two signal, one is SIN waveform and another is COS waveform (like picture 1). Now I want to draw two signal like XY-Chart, how can I fix the same scale of X and Y axis? In the same view scale, the path must like a Circle.
The numeric axis in our app weirdly displays the range from -2000 until 8000, even if it has or hasn’t got data series appended to it. I tried setting the VisibleRange and VisibleRangeLimit when creating the axis, but still no results. Here’s a piece of the code:
new SCINumericAxis
{
AxisAlignment = SCIAxisAlignment.Left,
AxisId = "axis_id",
TextFormatting = " 0%",
VisibleRangeLimit = new SCIDoubleRange(-30, 100),
VisibleRange = new SCIDoubleRange(-30, 100)
};
The Y values that we have are doubles, example:
[0]: 98.26171875
[1]: 0
[2]: NaN
[3]: 98.26171875
[4]: 0
[5]: NaN
[6]: 78.203125
[7]: NaN
[8]: 38.96484375
[9]: NaN
[10]: 98.28125
[11]: 0
[12]: NaN
[13]: 68.22265625
[14]: 0
So just by looking at the values, we should have a data range from 0 to 100, but I think somehow it messes up the conversion and ends up with ridiculously large numbers. I’m not doing any additional operations on the data, the printed data above is the data from the XyDataSeries. The Y type is Double, the YMin is 0, the YMax is 98, but still ends up drawing the values until 10000.
SciChart WPF control
I’m trying to configure the axis range using VisibleRange. Is it possible that in Visible range, I set only min value and then max value is set automatically by tracking the maximum value series has? Same way, if I set max value of VisibleRange then min value is set automatically by tracking min value of the series? How to achieve the VisibleRange setting by just setting one of Min/Max value?
Hello!
I want to use three colors in Xaxis.
But I do not know how to use multiple colors at once.
can put multiple colors through Xaxes,
but when move the scroll bar, the Xaxes colors do not move together. (Top and Buttom Xaxes colors)
I want to move the colors of both Xaxes together. or want to assign multiple colors(over the 3 Colors) to one Xaxis.
You can see the code and graphs through the image.
Tell us how to use it.
Thank you!
I want to paint my time axis like this:
Or just highlight last week, day, hour.
Is there way to apply style only on part of axis?
Hi, I want to color the axis label by its value,
eg. value< 0 -> show with red color
value = 0 -> show grey color
value > 0 -> show green color
similar to this question, but in android platform, it seems the LabelProvider has function related to the value(string) formatting only. Is there any ways to styling the label? Thanks!
It seems that if the axis is collapsed, all associated annotation labels are not visible (but their annotation line is visible).
Is there property or the like that will allow labels to be shown which are associated with a collapsed axis?
Is there an example of building a custom axis using a long or ulong?
So far I’ve tried implementing AxisBase and created necessary types for the given interfaces (IRange, IDeltaCalculator, IAxisDelta). But after implementing the minimum set of pieces, the chart comes up blank.
Also strangely the only two functions that get called on the AxisBase implementation are
GetDefaultNonZeroRange()
IsOfValidType() — This gets called with a DoubleRange rather than my ULongRange.. Somehow a DoubleRange is being introduced, but I can’t see how.
Is there any good documentation/design info out there about how to do this?
I have attached the solution I’ve been working with.
We are evaluating SciChart for use in our product which includes displaying higher precision date time information that the .NET framework DateTime can provide (1 tick = 100ns resolution).
I started by sub-classing the AxisBase class, but I am having issues finding documentation that could help in implement certain methods.
Some of the methods below are outlined–but a full, custom axis example (i.e. example of DateTimeAxis) would be of even greater help.
IRange CalculateYRange(RenderPassInfo renderPassInfo) — Is this only used for YAxis? How does orientation affect the range?
List GetSupportedTypes() — Is this supported IRange types? What types are these?
IRange GetDefaultNonZeroRange() — Is this just the smallest non-Undefined range? Else what is default?
void CalculateDelta() — This has no parameters or return values. The documentation is not clear on what members must need to be set here. Without any example it seem impossible to know how to implement this.
Why does IRange define Diff as type T? In the case of DateRange Diff becomes DateTime. Shouldn’t diff be of type TimeSpan? Are the ticks in the DateTime simply used as a TimeSpan type value? (Assuming Diff is the span of the range). I could implement IRange and use different types (DateTime and TimeSpan) respectively for Min/Max and Diff in this case (assuming I don’t need the templated version of the type.
in IOS SDK there are SCIAxisRangeSyncronization and SCIAxisAreaSizeSyncronization for dealing with axis sync. I would like to ask are there any similar classes in Android to do this ? Thanks.
Hi,
i have an horizontal line annotation in my chart at a fixed value (some hint for the user “minimum level”) that i always want to be visible. Thus, i’d like to set the axis/chart so that it always shows a range from 0 to 0.05, or larger range if the chart values exceed this range.
I’ve tried to set-up the VisualRangeLimit property to fit my needs but could not achieve my goal.
<s:NumericAxis AxisAlignment="Left"
Id="MagnitudeAxis"
VisibleRangeLimit="0, 0.05"
AxisTitle="{lex:Loc MagnitudeAxisLabel}" />
Are there other options to achieve this or am i doing somthing wrong?
Hi,
I’m trying to achieve the looks of DateTimeCategory XAxis as shown on uploaded screenshot.
Formatting a single row of tick labels is not a hard task (setTextFormatting). The problem arises when there are 2 rows with same frequency (days of the week and dates) and third row with lower frequency (years).
I tried using new line character in text formatting property to break the line for days and dates and it didn’t work. I also tried having two axes bound to the same data series, each one having different formatting and majorDelta, but it seems that they don’t stack up (only first one added is shown).
Any ideas?
Hello,
Currently I am using ViewportManager.AnimateZoomExtents to animate the data to fit the size of the graph. However, the animation causes the data to reach the very edge (X-Axis Max and Y-Axis Max). Is there a way that I can use AnimateZoomExtents to animate the data out but leave a 10% gap between the edge and X-Axis/Y-Axis Max?
I was able to do this using the following code, but I lose complete animation (which is what I’m looking for).
AxisYVisibleRange = new DoubleRange(AxisYVisibleRange.Min, AxisYVisibleRange.Max + (AxisYVisibleRange.Max * .10))
ViewportManager.AnimateZoomExtents(AnimateZoomTimeSpan);
Hi,
Can Axis show the value of 10-15 level data? Is there any limitation for the numeric axis?
Hi !
Does the android version of SciChart feature logartihmic axis scaling ?
I am showing tooltip with CursorModifier. My tooltip bigger than SciChartSurface and I am using ClipModifierSurface=”False” in order to show whole tooltip. But in this case axis labels and scroll bar are on top of tooltip.
Described problem can be seen on Featured Apps > Scientific Charts > Oscilloscope Demo.
Is there any way to bring tooltip on top of chart surface?
Thanks
Samvel
Hello,
I’m working with a polar chart and I’m having certain issues with the grid.
I’m trying to get a grid that covers all the surface, but I am not able to get it. I think it’s related to the Polar#Axis.
When I set a -200 margin on the Y axis, the grid lines separate and look like they are starting when I want, but they are not being draw outside the original circle.
When I set a -200 margin on the X axis, the outer circle goes outside the surface (red brush to watch it), but the Y axis does not reach the X axis and still inside the original circle.
Is there any way to get the desired grid?
I attach my code and a few images.
Thanks in advance.
<Grid Visibility="{Binding ShowPolarGrid, Converter={StaticResource BooleanToVisibilityConverter}}" >
<s:SciChartSurface Name="PolarGrid"
MaxFrameRate="24"
BorderBrush="Lime" BorderThickness="2">
<s:SciChartSurface.XAxis>
<s:PolarXAxis DrawMajorGridLines="True"
DrawMinorGridLines="{Binding PolarMinorLines}" MinorsPerMajor="2"
DrawMajorTicks="False"
DrawMinorTicks="False"
AutoRange="Never"
BorderBrush="Red"/>
</s:SciChartSurface.XAxis>
<s:SciChartSurface.YAxis>
<s:PolarYAxis DrawMajorGridLines="True"
DrawMinorGridLines="{Binding PolarMinorLines}" MinorsPerMajor="2"
DrawMajorTicks="False"
DrawMinorTicks="False"
VisibleRange="0, 1"
AutoRange="Never"
MajorDelta="1" />
</s:SciChartSurface.YAxis>
</s:SciChartSurface>
</Grid>
Hi
We are using a simple SciChart setup like the following:
<Grid Margin="20,45,50,20">
<!-- Create the chart surface -->
<s:SciChartSurface Name="SparseValuesPlot" s:ThemeManager.Theme="Chrome">
<!-- Declare RenderableSeries -->
<s:SciChartSurface.RenderableSeries>
<s:FastLineRenderableSeries DataSeries="{Binding Values}" Style="{Binding PlotStyle, Converter={StaticResource plotStyleConverter}}" />
</s:SciChartSurface.RenderableSeries>
<!-- Create an X Axis -->
<s:SciChartSurface.XAxis>
<s:NumericAxis AxisAlignment="Bottom" GrowBy="0.1, 0.1" AxisTitle="{Binding XAxisTitle}" AutoRange="Never" VisibleRange="{Binding XRange}" />
</s:SciChartSurface.XAxis>
<!-- Create a Y Axis -->
<s:SciChartSurface.YAxis>
<s:NumericAxis AxisAlignment="Left" GrowBy="0.1, 0.1" AxisTitle="{Binding YAxisTitle}" AutoRange="Never" VisibleRange="{Binding YRange}" />
</s:SciChartSurface.YAxis>
</s:SciChartSurface>
</Grid>
Is there a way to fix the aspect ratio of the chart such that a unit on the x-axis is displayed with the same number of pixels than a unit on the y-axis?
Right now the chart is streched with the surrounding grid. I tried to set height and width of the SciChartSurface but this does not keep the relations because the axis label areas may take different amount of space.
Thanks
Julian
I getting a weird behavior on my xAxis and yAxis with a real time SciChart.
The labels on axes and the chart itself start shaking like it is trying to update positions but it never gets steady.
I have a background routine adding data to the data series every second and every chart have two series with 2 YAxis, there are only two charts visible in the window at a given time.
Also I have noticed that after a few minutes of doing this the window itself get sluggish and not responsive anymore, I switch to another tab which doesn’t have a chart it start responding again.
Have anyone seeing something like this?
I have tried the Performance Tips and Tricks but nothing changes this behavior.
I’m using a Surface 3 pro with SciChart version 3.3.0.5909
Here is my XAML and the dispatcher timer adding data to the dataseries.
<UserControl
x:Class="PulseControl.CustomControls.RealTimeEnergy"
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:m="clr-namespace:PulseControl.Models"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:ee="http://schemas.microsoft.com/expression/2010/effects"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:Custom="http://metro.mahapps.com/winfx/xaml/shared"
xmlns:PulseControl="clr-namespace:PulseControl"
xmlns:converters="clr-namespace:PulseControl.Converters"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:s="http://schemas.abtsoftware.co.uk/scichart"
xmlns:cc="clr-namespace:PulseControl.CustomControls"
Width="Auto"
Background="{StaticResource WindowBackgroundBrush}"
mc:Ignorable="d" d:DesignHeight="140" d:DesignWidth="600" d:DataContext="{d:DesignInstance {x:Type m:MainWindowsModel}}"
>
<UserControl.Resources>
<ResourceDictionary>
<converters:IntToKiloConverter x:Key="Int2Kilo" />
</ResourceDictionary>
</UserControl.Resources>
<DockPanel
Background="{StaticResource WindowBackgroundBrush}" >
<Grid
DockPanel.Dock="Top"
Height="140">
<Grid.RowDefinitions>
<RowDefinition Height="100"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="170"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="170"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border
Grid.Column="0"
Grid.Row="0"
CornerRadius="50"
Width="170"
Margin="0"
Padding="0"
Background="{StaticResource ColorLeftChartBrush}"
BorderThickness="1">
<TextBlock
Style="{StaticResource FieldTextBoxStyle}"
Foreground="{StaticResource BlackBrush}"
HorizontalAlignment="Center"
Padding="0"
Margin="0"
FontSize="60"
VerticalAlignment="Center"
Text="{Binding Laser.OpData.AvgKiloVoltagePerSecond, Mode=OneWay, StringFormat={}{0:N1}}">
</TextBlock>
</Border>
<Label
Grid.Column="0"
Grid.Row="1"
Style="{StaticResource FieldLabelStyle}"
FontSize="20"
HorizontalAlignment="Center"
VerticalAlignment="Top">
Voltage (kV)
</Label>
<s:SciChartSurface
Name="sciChart"
Grid.Column="1"
Grid.RowSpan="2"
Height="140"
Background="{StaticResource WindowBackgroundBrush}"
s:SciChartGroup.VerticalChartGroup="OPERATION"
Width="Auto"
Margin="0"
Padding="8 8 8 10"
RenderPriority="Low"
MaxFrameRate="30">
<s:SciChartSurface.RenderableSeries>
<s:FastMountainRenderableSeries
x:Name="serieVoltage"
SeriesColor="{StaticResource ColorLeftChart}"
StrokeThickness="2"
YAxisId="LAXIS"
DataSeries="{Binding ChartData.ChartDataVoltage}">
<s:FastMountainRenderableSeries.AreaBrush>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#A860a917" Offset="0"/>
<GradientStop Color="#3360a917" Offset="1"/>
</LinearGradientBrush>
</s:FastMountainRenderableSeries.AreaBrush>
</s:FastMountainRenderableSeries>
<s:FastMountainRenderableSeries
x:Name="serieEnergy"
SeriesColor="{StaticResource ColorRightChart}"
StrokeThickness="2"
YAxisId="RAXIS"
DataSeries="{Binding ChartData.ChartDataEnergy}">
<s:FastMountainRenderableSeries.AreaBrush>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#A83376E5" Offset="0"/>
<GradientStop Color="#333376E5" Offset="1"/>
</LinearGradientBrush>
</s:FastMountainRenderableSeries.AreaBrush>
</s:FastMountainRenderableSeries>
</s:SciChartSurface.RenderableSeries>
<s:SciChartSurface.XAxis >
<s:DateTimeAxis Name="xAxis" AutoRange="Always" IsStaticAxis="True" TextFormatting="dd HH:mm" SubDayTextFormatting="HH:mm:ss" CursorTextFormatting = "mm:ss" Foreground="White" />
</s:SciChartSurface.XAxis>
<s:SciChartSurface.YAxes>
<s:NumericAxis
AutoRange="Always"
GrowBy="0,0.5"
IsPrimaryAxis="True"
AxisAlignment="Right"
Id="RAXIS"
Style="{StaticResource NoMinorLines}">
</s:NumericAxis>
<s:NumericAxis
AutoRange="Always"
GrowBy="0,0.25"
IsPrimaryAxis="False"
Id="LAXIS"
AxisAlignment="Left"
Style="{StaticResource NoMinorLines}">
</s:NumericAxis>
</s:SciChartSurface.YAxes>
<s:SciChartSurface.ChartModifier>
<s:ModifierGroup>
<s:RubberBandXyZoomModifier IsEnabled="{Binding ChartData.ZoomEnabled, Mode=TwoWay}" IsXAxisOnly="True"></s:RubberBandXyZoomModifier>
<s:ZoomPanModifier IsEnabled="{Binding ChartData.PanEnabled, Mode=TwoWay}"></s:ZoomPanModifier>
<s:MouseWheelZoomModifier IsEnabled="{Binding ChartData.MouseWheelEnabled, Mode=TwoWay}"></s:MouseWheelZoomModifier>
<s:RolloverModifier IsEnabled="{Binding ChartData.RolloverEnabled, Mode=TwoWay}"></s:RolloverModifier>
<s:CursorModifier IsEnabled="{Binding ChartData.CursorEnabled, Mode=TwoWay}"></s:CursorModifier>
<s:YAxisDragModifier></s:YAxisDragModifier>
<s:XAxisDragModifier></s:XAxisDragModifier>
<s:ZoomExtentsModifier></s:ZoomExtentsModifier>
</s:ModifierGroup>
</s:SciChartSurface.ChartModifier>
</s:SciChartSurface>
<Border
Grid.Column="2"
Grid.Row="0"
CornerRadius="50"
Width="170"
Margin="0"
Padding="0"
Background="{StaticResource ColorRightChartBrush}"
BorderThickness="1">
<TextBlock
Style="{StaticResource FieldTextBoxStyle}"
Foreground="{StaticResource BlackBrush}"
HorizontalAlignment="Center"
Padding="0"
Margin="0"
FontSize="60"
VerticalAlignment="Center"
Text="{Binding Laser.OpData.AvgEnergyPerSecond, Mode=OneWay, StringFormat={}{0:N1}}">
</TextBlock>
</Border>
<Label
Grid.Column="2"
Grid.Row="1"
Style="{StaticResource FieldLabelStyle}"
FontSize="20"
HorizontalAlignment="Center"
VerticalAlignment="Top">
Energy (mJ)
</Label>
</Grid>
</DockPanel>
Model
void _timer_Tick(object sender, EventArgs e)
{
DateTime now = DateTime.Now;
// Things to do when running
SafeAddPoint(_chartDataEnergy, now, Laser.OpData.AvgEnergyPerSecond);
SafeAddPoint(_chartDataEfficiency, now, Laser.OpData.ChamberEfficiency * 100.0);
SafeAddPoint(_chartDataVoltage, now, Laser.OpData.AvgKiloVoltagePerSecond);
SafeAddPoint(_chartDataPressure, now, Laser.OpData.Pressure);
SafeAddPoint(_chartDataSigmaEnergy, now, Laser.OpData.SampleSigma);
SafeAddPoint(_chartDataSigmaPercentage, now, Laser.OpData.SampleSigmaPercentage);
SafeAddPoint(_chartDataTemperature, now, Laser.OpData.Temperature);
}
private void SafeAddPoint(IDataSeries serie, DateTime dt, double val)
{
if (serie.ParentSurface != null)
using (serie.ParentSurface.SuspendUpdates())
((XyDataSeries<DateTime, double>)serie).Append(dt, val);
else
((XyDataSeries<DateTime, double>)serie).Append(dt, val);
}
I have a YAxis(NumericAxis) that indicates price, now I want to set different color to the label text(please see the uploaded image):
I’ve seen the ILabelProvider, but it seems to set string format.
How should I do?
Hi SciChart support,
we experience problems with clipping x axis values, depending on x-axis value range.
assume we have xaxis range from 1000000 to 1000001 and a diagram with a margin of lets say 10 pixels to the right of the container control. Depending on the zoom, the label of the mostright xaxis value(e.g. “1000001”) may be clipped just because the string is just too long. Would you recommend to change the margin dynamically to avoid the clipping or is there a way to prevent the chart from putting the rightmost xaxis value label if it exceeds the diagram bounds?
Hope you could help me.
Thanks in advance, Andreas
Hello.
Thank you for creating great chart library.
I’m now using a trial version for test that is enable to use at project that I’m concerned.
I have one problem that when I set zoom function to chart, and zoomed too much, axis label disappears.
(I used mouse scroll zoom, I attached zoom before image and after image)
How can I control this problem?
Is there any properties or setting for this?
Hi
I’m using auto range on a numeric axis. The data can be anything, but I want the axis to never have a range of less than 5.
E.g.: -100 to -95
E.g.: 17 to 22
E.g.: 0 to 5
etc.
What do I need to set to be able to do this? I have tried MinimalZoomConstrain and VisibleRangeLimit without success. Preferably something to set in XAML on my axis.
Thanks.
I’m trying to change the AutoRange property of my axis in a VisualStateManager storyboard and it’s throwing an exception saying the value is invalid. Is this not possible or should the object/property be accessed differently?
Exception: “The animation(s) applied to the ‘AutoRange’ property calculate a current value of ‘AutoRange.Once’, which is not a valid value for the property.”
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="AutoRange" Storyboard.TargetName="XAxis">
<DiscreteObjectKeyFrame KeyTime="0" Value="AutoRange.Once"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
.
.
.
<sc:NumericAxis x:Name="XAxis" AxisTitle="Time (s)" TitleFontSize="14" AutoRange="Always"/>
Thanks!
I want to implement a behavior on all axes with a mouse wheel. After quite some searching and trying I came up with a solution (possibly?).
In my control there are dynamically created one x-axis and several y-axes on one or more charts in a chartgroup.
But from the samples I get the impression the standard way would be to use a Modifier or a behavior like XAxisDragModifier (which does not use Wheel). And all tries to use a modifier did not work (for different reasons see below for some. One also is that I am getting more and more modifiers and they start to interfere with each other – like wheel on center area).
What am I trying to do and how do I think I could solve it “non-standard” way:
User Story:
User wants to change zoom (or pan) via mousewheel on axis.
(
Details just for info. Complete user story:
User can click on Axis to select it (it gets highlighted or border around it) and then the user can change via MouseWheel the Zoom or Pan.
Selecting Pan is done by pressing CTRL Key while mousewheel use. Otherwise zoom.
)
Possible Solution:
How do I think I could solve the mousewheel event capture:
Create a custom Axis:
public class CustomAxis : NumericAxis
{
protected override void OnMouseWheel(MouseWheelEventArgs e)
{
e.Handled = true;
// Do zooming or paning
}
}
Other options I ruled out:
Why can’t i use XAxisDragModifier? Besides it does not work with wheel: It does not work for me at all. Probably because my X-Axis has an ID. But that I don’t have during compile-time. So I cannot assign it. So my XAxisDragModifier does nothing.
Why do I not use YAxisDragModifier? Same problem. Several (unknown number) of YAxes with IDs i don’t have at compile time. I would have to add them at runtime. I have a custom behavior linking VMs to Axes and creating them. But debugging shows me that the Modifiers are not available at that time so I cannot add one.
Could this work? Or is there an obvious reason not to do it this way?
I would have to do the zoom and pan functions myself (I hope I can at this place)and I am using a custom ViewportManager as well.
Hi All,
Today’s weirdness was hard to track down but I can now demonstrate it with minimal code.
As a summary to the problem – we may generate multiple user controls each containing a chart that can’t all be viewed on screen at the same time. Our solution was to wrap everything in a ScrollViewer and allow the user to scroll through them. This caused the x Axis and any Right Aligned axis to do weird things with the chart.
On careful observation we noticed that any mouse movements in the axis while dragging were being interpreted as drags on the chart area so it would zoom (or pan) accordingly instead of dragging the Axis in question. Setting the scrollviewer scrollbar visibility to disabled returned the chart to expected behavior.
Can someone tell me what we did wrong or provide a work around suggestion.
The XAML:
<UserControl x:Class="WpfUITest.SciChartMultiaxisTest"
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" `enter code here`
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
xmlns:s="http://schemas.abtsoftware.co.uk/scichart"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<!-- <ScrollViewer CanContentScroll="False" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Disabled"> THIS IS OK -->
<ScrollViewer CanContentScroll="False" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<Grid>
<s:SciChartSurface x:Name="UserControlSciChartSurface" s:ThemeManager.Theme="Chrome" >
<s:SciChartSurface.XAxis>
<s:NumericAxis AxisAlignment="Bottom" AxisTitle="XAxis 1" GrowBy="0.01,0.01"/>
</s:SciChartSurface.XAxis>
<s:SciChartSurface.YAxes>
<s:NumericAxis x:Name="Left1" Id="Left1" AxisTitle="Left Axis" AxisAlignment="Left" />
<s:NumericAxis x:Name="Right1" Id="Right1" AxisTitle="Right Axis" AxisAlignment="Right" />
</s:SciChartSurface.YAxes>
<s:SciChartSurface.ChartModifier>
<s:ModifierGroup>
<!-- <s:ZoomPanModifier x:Name="ZoomPanModifier" ExecuteOn="MouseLeftButton" /> -->
<s:RubberBandXyZoomModifier x:Name="rubberBandZoomModifier" ExecuteOn="MouseLeftButton"/>
<s:ZoomExtentsModifier x:Name="zoomExtentsModifier" ExecuteOn="MouseDoubleClick"/>
<s:XAxisDragModifier x:Name="xAxisDragModifier" IsEnabled="True" ClipModeX="None" />
<s:YAxisDragModifier AxisId="Left1" IsEnabled="True" />
<s:YAxisDragModifier AxisId="Right1" IsEnabled="True"/>
</s:ModifierGroup>
</s:SciChartSurface.ChartModifier>
</s:SciChartSurface>
</Grid>
</ScrollViewer>
</Grid>
I put a simple test series on from the code behind as follows:
public void AddTestDataSeries()
{
XyDataSeries<int, int> testSeriesData = new XyDataSeries<int, int> { SeriesName = "Series1" };
for(int x = 1; x < 10; x++)
{
testSeriesData.Append(x, x);
}
FastLineRenderableSeries testSeries = new FastLineRenderableSeries();
testSeries.DataSeries = testSeriesData;
testSeries.YAxisId = "Left1";
testSeries.SeriesColor = Colors.Red;
this.UserControlSciChartSurface.RenderableSeries.Add(testSeries);
}
Any ideas anyone?
Someone recently asked the question on priority support tickets
Q: How do I have two YAxis on the left and right of the chart but with
the same VisibleRange?
e.g. how to mirror the YAxis on both sides of the chart
We are replicating the answer below for benefit of our userbase:
I would like to template items of an AxisCollection assigned to a sciChartSurface in binding of an AxisItemCollectionViewModel. But it looks like I cannot do it as Visual Studio won’t compile my tries.
What i am looking for is something like the EEG 16 channel sample. There the ListBoxItems are styled via a template which is bound to a ViewModelItem. The ListBox itsself is bound to a ViewModelCollection. Depending on how many entries there are entries in the listbox.
So I would like to do something like this:
<SciChartSurface.AxisCollection ItemsSource="{Binding MyAxisCollectionViewModels}" ItemTemplate="{StaticResource AxisItemTemplate}" />
Is this possible? I don’t know how many y-axes i will have. They are configurable by the user.
Hello,
How do I right-justify the numbers on the y-axis? The y-axis is on the left side of my chart.
Thanks,
Neville
i want to make y axis big in range as you can see in screenshot . Yaxis is small in Height
want to make it full screen