Pre loader

Tag: Axis

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0 votes
22k views

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?

  • Yuhang Ji asked 8 years ago
  • last active 8 years ago
1 vote
20k views

I want YAxis Auto Scale less than the value max 10% and greater value min 10%, how?

  • kingsoff asked 11 years ago
  • last active 9 years ago
0 votes
19k views

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.

0 votes
19k views

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:

1 vote
18k views

I wonder how I can disable the x-Axis from automatically re-scaling when panning a series beyond the available data range? The only time when axes scales change should be when I modify the axes scales via mouse on the respective axis itself. But when I pan a series I do not want any changes in axes scale to occur. How can I accomplish that? Thanks

  • bbmat asked 9 years ago
  • last active 9 years ago
1 vote
18k views

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 12 years ago
  • last active 9 years ago
0 votes
17k views

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?

  • Igor Peric asked 7 years ago
  • last active 7 years ago
1 vote
17k views

I made an example based on the “Vertically Stacked Axes” from SciChart Examples. The main difference is that I can add DataSeries / YAxes on the fly.

The problem is that when I set VisibleRange and VisibleRangeLimit it does not crop the trace (as you can see on the Tan traces that are drawn on the whole surface).

Is there any way to crop the traces to VisibleRange of corresponding Axis?

  • Jan Kaiser asked 9 years ago
  • last active 9 years ago
0 votes
16k views

On priority support tickets, a user just asked us how to show and hide the AxisTitle TextBlock without changing the AxisTitle.Text to string.Empty.

The solution uses attached properties and a small custom style, so we thought we’d post it below

0 votes
16k views

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?

0 votes
0 answers
15k views

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>
  • S C asked 8 years ago
0 votes
15k views

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

  • Roland D asked 5 years ago
  • last active 2 years ago
0 votes
15k views

take the SciChart Trader as an example, x-Axis is type of CategoryDateTimeAxis. I want a way to show the index of the time in the collection, when mouse moves over the price bar in some mode like Rollover or Cursor.

regards
chunxi

  • chunxi asked 9 years ago
  • last active 9 years ago
1 vote
15k views

Hi, I’m trying to position vertical line annotations on a chart. I want to position them on a visible part of the chart, but I need to use the Absolute coordinate mode as I want the annotation to move with the data as the chart is panned or zoomed.

My question is then: how can I find the currently visible extents of the X axis? If the chart is zoomed or panned I need to know what the left and rightmost visible X-axis values are (independent of the data).

0 votes
14k views

Hi,

I have some charts binded to a viewmodel. I wanted to produce a bar chart, so I want to modify the AxisAlignment.

If I specify a hardcoded alignment in the XAML, it works fine.

If I bind the alignment to the viewModel, the chart does not render, and I get the following error in the output:

 SciChartSurface didn't render, because an exception was thrown:
      Message: The specified Visual and this Visual do not share a common ancestor, so there is no valid transformation between the two Visuals.

Stack Trace:    at System.Windows.Media.Visual.TransformToVisual(Visual visual)
   at A.cac257c85637821690b32a44bda9b120f.cd0eaed29fc1e87dfe7aa912a7f678b57(FrameworkElement c5aaca7e2018a1512249ec2e2170b4cc6, UIElement c708323fb6eac118d4fd2c5913dc2a6ed)
   at A.cac257c85637821690b32a44bda9b120f.cd0eaed29fc1e87dfe7aa912a7f678b57(FrameworkElement c5aaca7e2018a1512249ec2e2170b4cc6, IHitTestable cc9d5fbe91f2861ee865bbb5439d3b84d)
   at Abt.Controls.SciChart.Visuals.Axes.AxisBase.GetAxisOffset()
   at Abt.Controls.SciChart.Visuals.Axes.AxisBase.GetAxisParams()
   at Abt.Controls.SciChart.Visuals.Axes.AxisBase.OnBeginRenderPass()
   at A.cda144392e546b245ef5bb1ee71f22b3a.c64a51c8ba6b7cbda8b9d9380d6337036(ISciChartSurface c17037e8328cd0abc02d2a6957dfa450c, RenderPassInfo c16b8d70d2b6ecad8f9fca7ac3f5177b8)
   at A.cda144392e546b245ef5bb1ee71f22b3a.c1a2306a5cc0452a04d135e77f0de4ff1(ISciChartSurface c17037e8328cd0abc02d2a6957dfa450c, Size cacf0a4a95d1143f0c11e20d4508e7132)
   at A.cda144392e546b245ef5bb1ee71f22b3a.RenderLoop(IRenderContext2D renderContext)
   at Abt.Controls.SciChart.Visuals.SciChartSurface.ca065c0b671221e0e603d0e9bf2792494()

This is the axis XAML:

 <s:SciChartSurface.XAxis>
                                    <s:NumericAxis AxisAlignment="{Binding XAxisAlignment}" LabelProvider="{Binding LabelProvider}" AutoTicks="False" MajorDelta="1" MinorDelta="1" DrawMinorGridLines="False">
                                    </s:NumericAxis>
                                </s:SciChartSurface.XAxis>

                                <s:SciChartSurface.YAxis>
                                    <s:NumericAxis AxisAlignment="{Binding YAxisAlignment}" AxisTitle="Number of crimes" GrowBy="0,1"/>
                                </s:SciChartSurface.YAxis>

And the properties I’m binding to:

public AxisAlignment XAxisAlignment { get; private set; }

public AxisAlignment YAxisAlignment { get; private set; }

Any help is appreciated.

Thanks,
Charbel

  • cabdo asked 10 years ago
  • last active 10 years ago
0 votes
14k views

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

0 votes
14k views

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.

1 vote
14k views

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.

  • Uwe Hafner asked 9 years ago
  • last active 9 years ago
0 votes
14k views

I have a few problems that I’m trying to address with y-axis labelling.

  1. I am including a y-axis on the left side of my graph but want the text of the labels to be right-aligned. Each label uses two lines of text. How can I do that?
  2. I want the margin of the text to be a specific width so that I can line up the y-axis of multiple scichart surfaces that are stacked vertically. How can I set each of my scichart surfaces to use a particular margin for the y-axis labelling?
  3. The y-axis label text will wrap when I don’t want it to (see attached image — The text of the label should be “1m \n Left” and I am currently seeing “1m \n Lef \n t”). How do I turn off the wrapping of text on the y-axis?

———-

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
    )
}
0 votes
0 answers
14k views

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.

  • Jazz Kuo asked 5 years ago
  • last active 5 years ago
0 votes
14k views

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?

0 votes
14k views

Hi, guys

Is it possible to draw axis line at axis area? See attachment.

0 votes
14k views

I’m trying to have a two charts which have a x-axis points (datetime) that doesn’t intersect. And i want charts was synchronized like this:
enter image description here

How you can see here upper chart doesn’t have a point at 10.12.2013, but lower has. Can i reach same effect by SciChart?

  • l1pton17 asked 10 years ago
  • last active 10 years ago
0 votes
13k views

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?

0 votes
13k views

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!

0 votes
13k views

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!

  • may lym asked 6 years ago
  • last active 6 years ago
0 votes
13k views

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

0 votes
13k views

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?

  • KC asked 6 years ago
  • last active 6 years ago
0 votes
12k views

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

0 votes
12k views

Hi !

Does the android version of SciChart feature logartihmic axis scaling ?

0 votes
12k views

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.

  • Ray Hung asked 7 years ago
  • last active 7 years ago
1 vote
12k views

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!

0 votes
11k views

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.

  • Brad Taber asked 4 years ago
  • last active 4 years ago
0 votes
0 answers
11k views

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!

1 vote
11k views

Hi,
I have some special requirements to solve. First point is to align the axis title position to the top of the axis. So the title is above the axis.

Second thing is to manually edit the visible range min and max inside the axis. So that the label min and max are editable.

Is there any way to do that?

Regards Markus

1 vote
0 answers
11k views

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?

0 votes
11k views

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.

0 votes
10k views

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).

0 votes
10k views

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:

  • I have 2 fastlinerenderable series each with 2 Yaxis for itselves and 2 shared XAxis.
  • I also have a modified listbox which is have it’s sincronization synced to the chart.
  • have a modifiergroup to pan,zoom and select.

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.

0 votes
0 answers
10k views

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.

0 votes
10k views

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);
    }
1 vote
10k views

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.

  • Uwe Hafner asked 9 years ago
  • last active 2 years ago
0 votes
0 answers
10k views

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:

https://www.scichart.com/example/wpf-chart-example-add-or-remove-dataseries-in-code/

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?

0 votes
10k views

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?

0 votes
10k views

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.

0 votes
0 answers
9k views

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> 
0 votes
9k views

Hi,

Can Axis show the value of 10-15 level data? Is there any limitation for the numeric axis?

  • Ming Fang asked 7 years ago
  • last active 7 years ago
1 vote
9k views

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

1 vote
9k views

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);
0 votes
9k views

Hi, I want to make the YAxis show only certain label (max, min, or others) only like the attached image. I want to ask if it is possible to show axis value unevenly. Thanks!

  • may lym asked 6 years ago
  • last active 6 years ago
Showing 1 - 50 of 67 results

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies