Pre loader

Tag: CategoryDateTimeAxis

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

1 vote
5k views

Hello support team,

I’m using a SciChartSurface Chart with a CategoryDateTimeAxis (xAxis).
The chart should contain three stacked bar columns and Annotations between the columns.

How can I place the Annotations exactly between the columns with consideration of the dynamic width of chart surface? I haven’t found the exactly property or solution for this particular case.

Thanks for your support in advanced!

0 votes
13k 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.

0 votes
8k views

Hi,

I have several chart panes that share a mouse group and a shared visual range (I inject the shared visual range of type IRange in the constructor of the pane view model). I then set the XAxis visual range to the shared visual range inside each pane view model. However, when I use either of the below approaches outside of the pane view model to adjust the min and max of shared visual range, the Xaxis.VisualRange of each pane does not reflect that change.

Approach A: _sharedVisualRange.Min = ….; _sharedVisualRange.Max = …
Approach B: _sharedVisualRange.SetMinMax(….)

Neither approach actually impacts the XAxis.VisualRange.Min/Max.

Initially when I created the XAxis in code I set its VisualRange equal to the shared visual range that was injected via constructor, like :

XAxis = new CategoryDateTimeAxis()
{
……
……
VisualRange = _sharedVisualRange,
…..
};

Please note that all the above refers to code in the view model. I bind the XAxis in the pane view model to the XAxis of the surface in xaml.

My entire synchronization heavily relies on the assumption of this working, but it does not.

  • bbmat asked 6 years ago
  • last active 6 years ago
0 votes
9k views

Hi,
I am creating iOS aplication which displays charts based on stocks data.
I want to create box annotations to show when market is open or closed.
I am using CategoryDateTimeAxis to display data but when i add AnnotationCollection with BoxAnnotations to Surface i can not see the annotations.

This is my code for creating box Annotation:

    let pre = SCIBoxAnnotation()
    pre.coordinateMode = .relative
    pre.x1 = SCIGeneric(setDate(date, 4, 0, 0)!)
    pre.x2 = SCIGeneric(setDate(date, 9, 30, 0)!)
    pre.y1 = SCIGeneric(max )
    pre.y2 = SCIGeneric(0)
    pre.isEditable = false
    pre.style.fillBrush = SCISolidBrushStyle(color: #colorLiteral(red: 0.01680417731, green: 0.1983509958, blue: 1, alpha: 0.13))
    pre.style.borderPen = SCISolidPenStyle(color: .clear, withThickness: 0)
  • Marcin C asked 6 years ago
  • last active 6 years ago
3 votes
0 answers
7k views

Hi there!
I successfully build trader chart from nice example “2D Charts -> Create Stock Charts -> Using SciStockChart”.
Then I had to draw line on the chart with candles, but the problem was, that the line didn’t have data on some dates (there is data for lots of candles, but for the red line there is only 4 points: A,B,C,D), and result i want in shown here (solved):
Result i want image

Axes:
XAxis: CategoryDateTimeAxis (Dates)
YAxis: NumericAxis (Prices)

Series:
Candles: FastCandlestickRenderableSeries (OhlcDataSeries<DateTime, double>)
Red Line: FastLineRenderableSeries (XyDataSeries<DateTime, double>)

Problem:
CategoryDateTimeAxis type ignores the XAxis values for computation of x-coordinate, and choosing only the index of the value instead. CategoryDateTimeAxis vs DateTimeAxis. I have N-number of candles and only 4 values for red line. How to receive line with no gaps, with points on their places (dates on X-axis) ? I can’t use simple DateTimeAxis, because candles don’t draws.

Solution:
1) Use double.NaN for each date (x-axis value) if no data for the red-line on date given.
2) In FastLineRenderableSeries set DrawNaNAs = LineDrawMode.ClosedLines (if don’t use this flag, you will receive something like this: WPF Chart Gaps (Nulls) in Series

Thanks a million to Julia Skorobogata from SciChart!

0 votes
7k views

I am considering applying server-side licensing for my javerScript application.

In the document below, there is a phrase “Our server-side licensing component is written in C++.”
(https://support.scichart.com/index.php?/Knowledgebase/Article/View/17256/42/)

However, there is only asp.net sample code on the provided github.
(https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-dotnet-server-licensing)

I wonder if there is a sample code implemented in C++ for server-side licensing.

Can you provide c++ sample code?
Also, are there any examples to run on Ubuntu?

  • Igor Peric asked 7 years ago
  • last active 7 hours ago
0 votes
6k views

I am considering applying server-side licensing for my javerScript application.

In the document below, there is a phrase “Our server-side licensing component is written in C++.”
(https://support-dev.scichart.com/index.php?/Knowledgebase/Article/View/17256/42/)

However, there is only asp.net sample code on the provided github.
(https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-dotnet-server-licensing)

I wonder if there is a sample code implemented in C++ for server-side licensing.

Can you provide c++ sample code?
Also, are there any examples to run on Ubuntu?

  • Igor Peric asked 7 years ago
  • last active 7 years ago
2 votes
11k views

I am implementing a feature to load more historical data when users pan to the left side on a CategoryDateAxis.
To load more, i need to have 2 Date which is the earliest data point i have and the Date that is shown on the X-Axis

For the earliest data point, i can get via IXyDataSeries#getXMin()
But for the other Date, i’m not sure how to get it. I can listen to range changes via IAxisCore#VisibleRangeChangeListener, but the range returns Double. I cant figure out to convert it into a Date

  • abc def asked 7 years ago
  • last active 7 years ago
0 votes
7k views

Based on the example in https://www.scichart.com/documentation/android/v1.x/webframe.html#Axis%20Types.html


IAxis axis = new CategoryDateAxis(getActivity());
axis.setAxisAlignment(AxisAlignment.Right);
axis.setAutoRange(AutoRange.Once);
axis.setGrowBy(new DoubleRange(0.1d, 0.1d));
axis.setVisibleRange(new DateRange(dateMin, dateMax));

It will crash at setVisibleRange with

java.lang.UnsupportedOperationException: Expected instance of DoubleRange
at com.scichart.core.utility.Guard.instanceOf(SourceFile:45)
at com.scichart.core.utility.Guard.instanceOfAndNotNull(SourceFile:52)
at com.scichart.charting.visuals.axes.AxisCore.setVisibleRange(SourceFile:241)

What would be the proper way to set a date range?

  • abc def asked 7 years ago
  • last active 7 years ago
0 votes
10k views

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

Hello

I want to change the major tick of a CategoryDateTimeAxis.
I saw “Advanced Tick Frequency Overriding”.
It’s very helpful for me.

I tried to extends CategoryTickCoordinatesProvider class but I think that shouldn’t be work.

So how should I do?
Please help me, thanks

0 votes
8k views

I’m trying to set the visible range property of a CategoryDateTimeAxis through MVVM. I’m following the general instructions detailed here for converting between pixel & data coordinates on the axis:

https://www.scichart.com/questions/question/categorydatetimeaxis-in-mvvm#sabai-inline-nav

I have the following code in my viewmodel:

XAxis.OnBeginRenderPass();
var calc = XAxis.GetCurrentCoordinateCalculator();
var coordCalc = calc as ICategoryCoordinateCalculator;

XAxis is a CategoryDateTimeAxis injected from the view. I call OnBeginRenderpass as I saw in another forum post that this will ensure that the CoordinateCalculator is initialized.

calc shows in the debugger as:

  • calc {A.} Abt.Controls.SciChart.Numerics.CoordinateCalculators.ICoordinateCalculator {A.}

The coordCalc variable ends up assigned to NULL, as the ICoordinateCalculator< double > cannot be cast to the interface.

How do I accomplish the above?

Thanks, Asher

  • ashernew asked 8 years ago
  • last active 8 years ago
0 votes
6k views

I’m creating stock OHLC Bar Charts. My users have asked me if I can create a chart such that when the trading is open and there are no trades, the X Axis behaves like a DateTimeAxis and empty space appears on the chart in the X direction between trades. However, they would like the times that trading to does not take place to not appear on the X Axis so that there is no space between the last minute of open trading for one trading session and the next minute of trading for the next session. Is such a chart possible with Sci Charts?

  • deepakb1 asked 8 years ago
  • last active 8 years ago
0 votes
10k views

I’m using the CategoryDateTimeAxis as a xaxis of one chart.

The picture below is my question, can you give some suggestions?

Thanks

  • Shawn Li asked 8 years ago
  • last active 8 years ago
0 votes
8k views

If I make my own implementation of AxisLabelprovider for a CategoryDatetimeAxis I get different DateTime.Kind settings depending on the function called to format a label.
I put in the values as DateTime.Kind = DateTimeKind.Utc to the DataSeries<DateTime, double>

I have this implementation for my labelprovider:

public class CategoryAxisLabelProvider : TradeChartAxisLabelProvider

    public override string FormatLabel(IComparable dataValue)
    {
        DateTime value = (DateTime)Convert.ChangeType(dataValue, typeof(DateTime));
        if (value.Kind != DateTimeKind.Local)
        {
            value = value.ToLocalTime();
        }

        string s = value.ToString("HH:mm:ss\nfff 'ms'");
        return s;
    }

    public override string FormatCursorLabel(IComparable dataValue)
    {
        // do something
    }

If FormatCursorLabel is called the “dataValue” has DateTime.Kind = DateTimeKind.Utc.
If FormatLabel is called the “dataValue” has Datetime.Kind = DateTimeKind.Unspecified. (Although the value is UTC)

How to handle DateTimeKind.Unspecified? Is it Utc or does it depend on what I put into the dataseries?

  • Uwe Hafner asked 9 years ago
  • last active 9 years ago
Showing 15 results

Try SciChart Today

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

Start TrialCase Studies