Pre loader

Tag: #Rendering

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

I try to add data series and have them rendered on a chart surface. The surface and entire chart library is wrapped in an mvvm-based api. The sci chart control and wrapping library are rendered on a document panel. I add new data series via the viewmodel and here is where I have some unexpected behavior:

a) When being on a different document panel, meaning the chart control is NOT visible, and when I add a new data series via view model and then view the document panel that hosts the sci chart control, no chart series are rendered on the chart but I do see the correct legend data (such as chart series name, color, stroke thickness). Please see below screen shot “Capture1.jpg” .

b) When I make the sci chart control visible by viewing the document panel that hosts the sci chart control and then via a button and command add the very same data series via my chart control’s view model the charts are correctly rendered. Please see “Capture2.jpg”.

My question is why is that the case? I basically expose a method in my chart library view model that lets me add data and if I invoke that methods while being on a document panel that does not host the chart control the added data series is not rendered on the chart. But strangely the correct chart legend data are displayed and also the chart control itself is correctly rendered. No problems when the hosting document panel is active and the very same method is invoked.

Basically what I currently observe is that the data series are not rendered at all as long as the chart control is not “in view” or the hosting document panel is not selected. I am sure programmatically all references and bindings are correct.

I have spend many hours debugging this issue and do not seem to find an answer. Any pointers?

Thanks a lot,
Matt

Edit:

Here is how I bind the content control to the view model of my sci chart charting library (user control)

<ContentControl Grid.Row="1" Content="{Binding ChartControl, Mode=OneWay}" />

…and the view model is instantiated in the hosting view model constructor:

public MainWindowViewModel()
    {
       ChartControl = new SciChartControlViewModel();

        ExitApplicationCommand = new RelayCommand(OnExitApplicationCommand);
        LoadDataSeriesFromFilesCommand = new RelayCommand(OnLoadDataSeriesFromFilesCommand);
        RefreshDataSeriesFromFilesCommand = new RelayCommand(OnRefreshDataSeriesFromFilesCommand);


        Test();

    }

…Test() performs the following action:

private void Test()
    {
        var quotes = new List<Quote>();
        List<DateTime> timeStamps = new List<DateTime>();
        List<double> values = new List<double>();
        List<SciChartAnnotation> annotations = new List<SciChartAnnotation>();
        Random rand = new Random((int)DateTime.Now.Ticks);
        DateTime currentDt = DateTime.Now;
        double currentValue = 0;

        for (int index = 0; index <= 50000; index++)
        {
            var randomValue = rand.NextDouble();
            currentDt = currentDt + TimeSpan.FromSeconds(randomValue);
            currentValue = currentValue + randomValue - 0.5;

            if (index % 1000 == 0)
            {
                var buySell = rand.NextDouble() > 0.5 ? SciChartAnnotationDirection.Buy : SciChartAnnotationDirection.Sell;
                annotations.Add(new SciChartAnnotation(buySell, currentDt, currentValue, "Index:" + index));
            }

            timeStamps.Add(currentDt);
            values.Add(currentValue);

            quotes.Add(new Quote(){DataProviderId = "Provider1", SymbolId = "Symbol1", QuoteType = QuoteType.BidAsk, CompressionType = TimeCompressionType.NoCompression, CompressionUnits = 0, TimeStamp = currentDt, Bid = currentValue, Ask= currentValue + 0.05, });

        }

        ChartControl.AddDataSet("Pane1", "0.00000", quotes, annotations);
        //ChartControl.AddDataSet("MattSeries", ChartType.Scatter, 1, "0.00000", timeStamps, values);

    }

…it basically tries to render chart series and annotations.

Strangely, as mentioned before, the series legends render correctly and the annotations also all render correctly but the chart series do not! Could this be a bug? Please refer to the image “Capture3” for a screenshot.

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

Hi,

If I create a bubble chart with auto x-range and keep appending bubbles (so the xrange grows over time to show all the data), after a while some of the bubbles will start to flash on and off. Its as though if they are centred between pixels then the whole bubble doesn’t get drawn.

Any ideas?

Cheers
Felix

  • F W asked 9 years ago
0 votes
11k views

In the oil industry a well survey is usually displayed by a series of points connected by arcs. An arc is very close to the actual path a drill will take between points on a survey. Survey points are about 90 feet apart, so connecting them with a straight line looks ugly. Which method should I override to accomplish this?

If I get ambitious, I may also consider using Bezier curves to connect points, as this could be useful to represent geological boundaries as a background for my well survey plots.

I have attached a picture showing the type of plots I need to make. The red line is a survey and the background represents geological layers. The survey is presently connected with straight lines, which makes it difficult to determine precisely where the survey intercept the boundaries.

0 votes
8k views

I was testing my charts on a simulator and when I naved away and then back to the chart screen the Simulator’s chart was totally black screen; I could move the mouse over the points and the popouts would occur; and your license notice showed in the center of the chart. So it was almost like it thought all the drawing for the chart itself needed to be black on black.

It was always broken on the 2nd or later chart. Restarting the app fixed it. I tried removing all custom settings, and calling the invalidate; and nothing caused it to redraw correctly… Fortunately, when deploying to real devices everything worked correctly. Is this an expected side effect of testing on a simulator, or is their something that I can do to force a hard refresh of the chart…

FYI: The additional debug diagnostics don’t seem to do anything on a simulator, or at least I couldn’t find anywhere it was logged.

0 votes
0 answers
10k views

I am creating a chart to represent certain vitals. The code is almost identical to the Vitals Monitoring Demo application, the difference being
I added some Line and text annotations. I am appending points to the data series every 100ms. I have verified that the anomalous behavior is not caused due to wrong data being provided,
leading me to believe it must be a bug within SciChart. I have attached screenshots of this anomalous behavior. Any help would be greatly appreciated. Thank you.

Edit: This happens randomly, ie it performs normally without glitches on application startup but misbehaves after left running for a while.
I also observed that when I call .clear() on the XyDataSeries objects, the graph returns to normalcy, but only until FIFO_CAPACITY is reached. It then goes back to wreaking havoc.
I have added sample data (data.txt) to the question for reference, and screenshots of Expected behavior and the abnormal behavior in question.

Gif of the problem is here: https://imgur.com/7SO4DFb

Code used for setting up the chart:

     `SciChartBuilder sciChartBuilder;
     static ISciChartSurface chart;
     public final static XyDataSeries<Double, Double> pressureDataSeries = newDataSeries(FIFO_CAPACITY);
     public final static XyDataSeries<Double, Double> pressureSweepDataSeries = newDataSeries(FIFO_CAPACITY);
     public final static XyDataSeries<Double, Double> flowDataSeries = newDataSeries(FIFO_CAPACITY);
     public final static XyDataSeries<Double, Double> flowSweepDataSeries = newDataSeries(FIFO_CAPACITY);
     public final static XyDataSeries<Double, Double> volumeDataSeries = newDataSeries(FIFO_CAPACITY);
     public final static XyDataSeries<Double, Double> volumeSweepDataSeries = newDataSeries(FIFO_CAPACITY);
     public final static XyDataSeries<Double, Double> lastPressureSweepDataSeries = newDataSeries(1);
     public final static XyDataSeries<Double, Double> lastFlowDataSeries = newDataSeries(1);
     public final static XyDataSeries<Double, Double> lastVolumeDataSeries = newDataSeries(1);
     private static XyDataSeries<Double, Double> newDataSeries(int fifoCapacity) {
    final XyDataSeries<Double, Double> ds = new XyDataSeries<>(Double.class, Double.class);
    ds.setFifoCapacity(fifoCapacity);
    return ds;
}
 private void setUpChart() {                          // Called from onCreate()
    try {
        SciChartSurface.setRuntimeLicenseKey("");
    } catch (Exception e) {
        e.printStackTrace();
    }
    final String pressureId = "pressureId";
    final String flowId = "flowId";
    final String volumeId = "volumeId";
    SciChartBuilder.init(this);
    sciChartBuilder = SciChartBuilder.instance();
    chart = new SciChartSurface(this);
    LinearLayout chartLayout = findViewById(R.id.charts);
    chartLayout.addView((View) chart, 0);
    final NumericAxis xAxis = sciChartBuilder.newNumericAxis()
            .withVisibleRange(0, 10)
            .withAutoRangeMode(AutoRange.Never)
            .withAxisBandsFill(5)
            .withDrawMajorBands(true)
            .withAxisId("XAxis")
            .build();

    DoubleValues pressureRange = new DoubleValues(); pressureRange.add(-10); pressureRange.add(65);
    DoubleValues flowRange = new DoubleValues(); flowRange.add(-150); flowRange.add(+250);
    DoubleValues volumeRange = new DoubleValues(); volumeRange.add(-500); volumeRange.add(1000);

    final NumericAxis yAxisPressure = generateYAxis(pressureId, getMinMaxRange(pressureRange));
    final NumericAxis yAxisFlow = generateYAxis(flowId, getMinMaxRange(flowRange));
    final NumericAxis yAxisVolume = generateYAxis(volumeId, getMinMaxRange(volumeRange));

    UpdateSuspender.using(chart, new Runnable() {
        @Override
        public void run() {
            Collections.addAll(chart.getAnnotations(),
                    sciChartBuilder.newTextAnnotation()
                            .withXAxisId("XAxis")
                            .withYAxisId(pressureId)
                            .withY1(0d)
                            .withFontStyle(18, ColorUtil.White)
                            .withText(" Pressure (cm H2O)")
                            .build(),
                    generateBaseLines(pressureId),
                    sciChartBuilder.newTextAnnotation()
                            .withXAxisId("XAxis")
                            .withYAxisId(flowId)
                            .withY1(0d)
                            .withFontStyle(18, ColorUtil.White)
                            .withText(" Flow (lpm)")
                            .build(),
                    generateBaseLines(flowId),
                    sciChartBuilder.newTextAnnotation()
                            .withXAxisId("XAxis")
                            .withYAxisId(volumeId)
                            .withY1(0d)
                            .withFontStyle(18, ColorUtil.White)
                            .withText(" Volume (ml)")
                            .build(),
                    generateBaseLines(volumeId)
            );
            Collections.addAll(chart.getXAxes(), xAxis);
            Collections.addAll(chart.getYAxes(), yAxisPressure, yAxisFlow, yAxisVolume);
            Collections.addAll(chart.getRenderableSeries(),
                    MainActivity.this.generateLineSeries(pressureId, pressureDataSeries, sciChartBuilder.newPen().withColor(Color.parseColor("#00ff00")).withThickness(1.5f).build()),
                    MainActivity.this.generateLineSeries(pressureId, pressureSweepDataSeries, sciChartBuilder.newPen().withColor(Color.parseColor("#00ff00")).withThickness(1.5f).build()),
                    MainActivity.this.generateScatterForLastAppendedPoint(pressureId, lastPressureSweepDataSeries),

                    MainActivity.this.generateLineSeries(flowId, flowDataSeries, sciChartBuilder.newPen().withColor(Color.parseColor("#ff6600")).withThickness(1.5f).build()),
                    MainActivity.this.generateLineSeries(flowId, flowSweepDataSeries, sciChartBuilder.newPen().withColor(Color.parseColor("#ff6600")).withThickness(1.5f).build()),
                    MainActivity.this.generateScatterForLastAppendedPoint(flowId, lastFlowDataSeries),

                    MainActivity.this.generateLineSeries(volumeId, volumeDataSeries, sciChartBuilder.newPen().withColor(Color.parseColor("#FFEA00")).withThickness(1.5f).build()),
                    MainActivity.this.generateLineSeries(volumeId, volumeSweepDataSeries, sciChartBuilder.newPen().withColor(Color.parseColor("#FFEA00")).withThickness(1.5f).build()),
                    MainActivity.this.generateScatterForLastAppendedPoint(volumeId, lastVolumeDataSeries)
            );
            chart.setLayoutManager(new DefaultLayoutManager.Builder().setRightOuterAxesLayoutStrategy(new RightAlignedOuterVerticallyStackedYAxisLayoutStrategy()).build());
        }
    });
}

private HorizontalLineAnnotation generateBaseLines(String yAxisId) {
    return sciChartBuilder.newHorizontalLineAnnotation().withStroke(1, ColorUtil.White).withHorizontalGravity(Gravity.FILL_HORIZONTAL).withXAxisId("XAxis").withYAxisId(yAxisId).withY1(0d).build();
}

private NumericAxis generateYAxis(String id, DoubleRange visibleRange) {
    return sciChartBuilder.newNumericAxis().withAxisId(id).withVisibleRange(visibleRange).withAutoRangeMode(AutoRange.Never).withDrawMajorBands(false).withDrawMinorGridLines(true).withDrawMajorGridLines(true).build();
}
private FastLineRenderableSeries generateLineSeries(String yAxisId, IDataSeries ds, PenStyle strokeStyle) {
    FastLineRenderableSeries lineSeries = new FastLineRenderableSeries();
    lineSeries.setDataSeries(ds);
    lineSeries.setPaletteProvider(new DimTracePaletteProvider());
    lineSeries.setStrokeStyle(strokeStyle);
    lineSeries.setXAxisId("XAxis");
    lineSeries.setYAxisId(yAxisId);
    return lineSeries;
}
private IRenderableSeries generateScatterForLastAppendedPoint(String yAxisId, IDataSeries ds) {
    final EllipsePointMarker pm = sciChartBuilder.newPointMarker(new EllipsePointMarker())
            .withSize(4)
            .withFill(ColorUtil.White)
            .withStroke(ColorUtil.White, 1f)
            .build();

    return sciChartBuilder.newScatterSeries()
            .withDataSeries(ds)
            .withYAxisId(yAxisId)
            .withXAxisId("XAxis")
            .withPointMarker(pm)
            .build();
}

private static DoubleRange getMinMaxRange(DoubleValues values) {
    final DoubleRange range = new DoubleRange();
    SciListUtil.instance().minMax(values.getItemsArray(), 0, values.size(), range);
    range.growBy(0.1, 0.1);
    return range;
}

   // Appending to data series with:
    UpdateSuspender.using(MainActivity.chart, new Runnable() {
        @Override
        public void run() {
            MainActivity.pressureDataSeries.append(x, ppA);
            MainActivity.pressureSweepDataSeries.append(x, ppB);

            MainActivity.flowDataSeries.append(x, vFlowA);
            MainActivity.flowSweepDataSeries.append(x, vFlowB);

            MainActivity.volumeDataSeries.append(x, vtfA);
            MainActivity.volumeSweepDataSeries.append(x, vtfB);

            MainActivity.lastPressureSweepDataSeries.append(x, pp);
            MainActivity.lastFlowDataSeries.append(x, vFlow);
            MainActivity.lastVolumeDataSeries.append(x, vtf);
        }
    });

`

1 vote
2k views

By following this example to create reusable SciChart component in React:

https://www.scichart.com/documentation/js/current/TutorialReusableReactComponent.html

The chart cannot be created when run in dev mode. But it works well under production mode. I think it’s because React renders components twice in strict mode. It seems that SciChart got problems to create chart with the following logic when running the application in dev mode. Is this true? Or I missed anything?

 useEffect(() => {
    const chartInitializationPromise = props.initChart(rootElementId).then((initResult) => {
        sciChartSurfaceRef.current = initResult.sciChartSurface;
        return initResult.sciChartSurface;
    });
    const performCleanup = () => {
        sciChartSurfaceRef.current.delete();
        sciChartSurfaceRef.current = undefined;
    };

    return () => {
        // check if chart is already initialized or wait init to finish before deleting it
        sciChartSurfaceRef.current ? performCleanup() : chartInitializationPromise.then(performCleanup);
    };
}, []);
  • Quyen Sy asked 8 months ago
  • last active 2 months ago
0 votes
9k views

Performance degrades at a much higher rate when adding FastBandSeries (with multiple axes) when compared to FastLineSeries (with one Y-Axis)

I have this demo project that shows the rendering stuttering that occurs when panning the FastBand Chart. To ensure that this is not some performance hit of purely having multiple Y-Axes, you can simply add one series and the behavior persists. (As well as I know there are examples with multiple Y-Axes with line series that are blazing fast).

I would really like to get to the bottom of this as the one chart type is dragging down the performance of our product overall.

Below the demo project is attached.

It has been 3 weeks since I’ve posted with no input or feedback — quite unacceptable.

0 votes
8k views

Hello SciChart,

I’m using SciChart:PerformanceHelper.EnableExtremeResamplers=”True” on my SciChart surface to display data with multiple gaps properly (NaN values), however the XPS output using ExportToFile does not work well and only renders the data to the first gap. Is there a workaround to this issue or how can it be fixed? Thank you.

Kind regards
Ondřej

0 votes
9k views

Running off of visual studio 2017. Slightly changed one of the line examples. Here is my source code.

// *************************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2017. All rights reserved.
//
// Web: http://www.scichart.com
// Support: [email protected]
// Sales: [email protected]
//
// LineChartExampleView.xaml.cs is part of the SCICHART® Examples. Permission is hereby granted
// to modify, create derivative works, distribute and publish any part of this source
// code whether for commercial, private or personal use.
//
// The SCICHART® examples are distributed in the hope that they will be useful, but
// without any warranty. It is provided “AS IS” without warranty of any kind, either
// expressed or implied.
// *************************************************************************************
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using SciChart.Charting.Model.DataSeries;
using SciChart.Charting.Visuals.RenderableSeries;
using SciChart.Data.Model;
using SciChart.Examples.ExternalDependencies.Data;
using SciChart.Charting;

namespace SciChart.Examples.Examples.CreateSimpleChart
{
public partial class LineChartExampleView : UserControl
{
public LineChartExampleView()
{
InitializeComponent();

    }

    private void LineChartExampleView_OnLoaded(object sender, RoutedEventArgs e)
    {            
        // Create a DataSeries of type X=double, Y=double
        var dataSeries = new XyDataSeries<double, double>();

        lineRenderSeries.DataSeries = dataSeries;

        var data = DataManager.Instance.GetFourierSeries(1.0, 0.1);

        // Append data to series. SciChart automatically redraws
        ThemeManager.SetTheme(this, "Chrome");
        dataSeries.Append(data.XData, data.YData);

        sciChart.ZoomExtents();
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        Clipboard.SetImage(this.sciChart.ExportToBitmapSource());
    }
}

}

And the xaml

<UserControl.Resources>
    <ResourceDictionary>
    </ResourceDictionary>
</UserControl.Resources>

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>

    <!--  The SciChartInteractionToolbar adds zoom, pan, zoom extents and rotate functionality  -->
    <!--  to the chart and is included for example purposes.  -->
    <!--  If you wish to know how to zoom and pan a chart then do a search for Zoom Pan in the Examples suite!  -->
    <Button Foreground="AntiqueWhite"  Visibility="Visible" Click="Button_Click" MinWidth="100" MinHeight="40">COPY</Button>



    <!--  Create the chart surface  -->
    <s:SciChartSurface Name="sciChart"
                       Grid.Column="1">

        <!--  Declare RenderableSeries  -->
        <s:SciChartSurface.RenderableSeries>
            <s:FastLineRenderableSeries x:Name="lineRenderSeries"
                                        Stroke="#FF99EE99"
                                        StrokeThickness="2"/>
        </s:SciChartSurface.RenderableSeries>

        <!--  Create an X Axis with Growby  -->
        <s:SciChartSurface.XAxis>
            <s:NumericAxis DrawMajorBands="True"
                           FlipCoordinates="True"
                           GrowBy="0.1, 0.1"
                           ScientificNotation="None"
                           TextFormatting="#.############" />
        </s:SciChartSurface.XAxis>

        <!--  Create a Y Axis with Growby. Optional bands give a cool look and feel for minimal performance impact  -->
        <s:SciChartSurface.YAxis>
            <s:NumericAxis DrawMajorBands="True" GrowBy="0.5, 0.5" />
        </s:SciChartSurface.YAxis>

    </s:SciChartSurface>
</Grid>

All I did was remove the toolbar and a dd a button that copied the image to the clipboard. Yet Somehow the result of what you see while running and what you get from the clipboard are not the same. The lower half of the image you get by rendering to memory is clearly darker. I tried uploading them but could not.

1 vote
5k views

Hi SciChart,

We are experiencing a SciChart XPS export issue.

I am using a FlowDocumentPageViewer with a FlowDocument containing SciChart graphs. My goal is to export all pages of the FlowDocument to an XPS file using the XamlRenderSurface to save in vector graphics. However, I’m facing an issue where only the currently selected page exports correctly, while the other pages display empty graphs.

By default, we employ the VisualXcceleratorRenderSurface for all SciChart render surfaces. Before exporting, I programmatically switch them to XamlRenderSurface to save in vector graphics. This approach works well when all the graphs have been rendered on-screen at least once with the new surface type before exporting. However, if a graph hasn’t been rendered on-screen before exporting, it appears empty, and only the graphs from the selected page export correctly. You can find code snippets below.

XAML code:

<s:SciChartSurface
    x:Name="PART_Surface"
    ...
    RenderSurface="{TemplateBinding RenderType, Converter={StaticResource RenderTypeConverter}}"
    ...

Converter:

public class RenderTypeConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        // Set render settings
        return (RenderType)value switch
        {
            RenderType.DirectX => new VisualXcceleratorRenderSurface(),
            RenderType.HighQuality => new HighQualityRenderSurface(),
            RenderType.HighSpeed => new HighSpeedRenderSurface(),
            RenderType.Vector => new XamlRenderSurface(),
            _ => new HighSpeedRenderSurface(),
        };
    }
    ...
}

Export:

private void ExportVector(string fullPath)
{
    // Sets the RenderType to Vector for all surfaces
    // This invokes RenderTypeConverter to set the RenderSurface to XamlRenderSurface
    // Since they are bound in the XAML code
    SetAxesSurfacesRenderToVector();

    XPS_Export_AllPagesOfFlowDocument(fullPath);

    // DirectX is always the default for all surfaces that we use
    ResetAxesSurfacesToDirectX();
}
private void XPS_Export_AllPagesOfFlowDocument(string fullPath)
{
    using (var package = Package.Open(fullPath, FileMode.Create))
    {
        using (var xpsDocument = new XpsDocument(package, CompressionOption.Maximum))
        {
            var xpsSerializationManager = new XpsSerializationManager(new XpsPackagingPolicy(xpsDocument), false);
            var documentPaginator = ((IDocumentPaginatorSource)FlowDocument)?.DocumentPaginator;
            xpsSerializationManager.SaveAsXaml(documentPaginator);

            xpsDocument.Close();
        }
    }
}

The binding and the converter works for all offscreen elements, yet the they won’t take effect until rendered on screen at least once.
I have to select each page manually, after setting all graphs to use XamlRenderSurface, so each would be rendered on screen at least once before the export.

My question is: How can I export XamlRenderSurfaces that are off-screen and haven’t been rendered on-screen before the export process?

You can find an image below showcasing the problem.

Thank you and looking forward to your reply!

Best Regards,
Kaloyan Krastev

1 vote
2k views

I’m overriding FastLineRenderableSeries so I can do some custom rendering.

I have a data series defined as :

 var xyDataSeries = new XyDataSeries<double>();
            xyDataSeries.Append(0, 0);
            xyDataSeries.Append(1, 1);
Test.DataSeries = xyDataSeries;

and my chart as :

<s:SciChartSurface Loaded="SciChartSurface_Loaded">
        <s:SciChartSurface.RenderableSeries>
            <customSeriesMvvmExample:FastLineRenderableSeriesEx x:Name="Test" />
        </s:SciChartSurface.RenderableSeries>
        <s:SciChartSurface.XAxis>
            <s:NumericAxis/>
        </s:SciChartSurface.XAxis>
        <s:SciChartSurface.YAxis>
            <s:NumericAxis/>
        </s:SciChartSurface.YAxis>
    </s:SciChartSurface>

And then I override InternalDraw :

public class FastLineRenderableSeriesEx : FastLineRenderableSeries
{
    protected override void InternalDraw(IRenderContext2D renderContext, IRenderPassData renderPassData)
    {
        base.InternalDraw(renderContext, renderPassData);

        using (var brush = renderContext.CreateBrush(Colors.Transparent))
        using (var pen = renderContext.CreatePen(Stroke, true, StrokeThickness, Opacity))
        {

            var xCalc = renderPassData.XCoordinateCalculator;
            var yCalc = renderPassData.YCoordinateCalculator;

            var xCoord = xCalc.GetCoordinate(0.5);
            var yCoord = yCalc.GetCoordinate(0.5);

            renderContext.DrawEllipse(pen, brush, new System.Windows.Point(xCoord, yCoord), 150, 150);

            renderContext.DrawLine(pen, 
                new System.Windows.Point(xCalc.GetCoordinate(0.6), yCalc.GetCoordinate(0)),
                new System.Windows.Point(xCalc.GetCoordinate(2), yCalc.GetCoordinate(1.4)));
        }
    }
}

The problem is that the base.InternalDraw draws the original data series line very nicely with anti-aliasing, but the custom circle I draw has no AA, and the custom line I draw looks very thin?

what’s going on here?

  • forl forl asked 10 months ago
  • last active 10 months ago
1 vote
8k views

This might be a feature request, I don’t know. Basically, I’m trying to plot a 3D scatter-plot and programmatically insert an arbitrary number of partially transparent free surface meshes in the same area as the scatter-plot. I started small and made some spheres. Some of my points are inside the spheres. These points are important, and I have my own functions that detect collisions between points and the spheres. The scatter-plot is also dynamic, where I update the color and transparency of the points and this means something. When all of the points are completely opaque, I get the desired behavior where I can see the points inside and behind the partially transparent meshes. However, when I make even one point transparent, all of the points inside and behind the mesh stop rendering. This is really annoying. Deletion is too slow. Is there anyway to force these fully opaque points to continue to render inside the partially transparent mesh while their brothers in the scatter-plot data series are transparent?

Second question, while I’m here. I’ve bolted a UI to the side of the Sci-Chart environment. What is the best way to make sure that the UI stays responsive even if the Sci-Chart environment starts to slow down? I want to crank up the point count past any reason.

https://www.youtube.com/watch?v=0IBBG6WEQw8 I’ve also uploaded a video of my problem. Before I check the box “Draw Geo-fence Violations Only”, all points in the data series 100% not transparent. When I check the box, all the white points start to become 100% transparent. When I click “Draw Geo-fences”, the meshes become 100% transparent (it’s backwards I know). The points are obviously still within the bounds of the mesh, as when the I turn off the mesh they start rendering. You can also see some red dots outside the mesh, as my program flagged a few points right next to the mesh as being inside it. These red dots outside the mesh render even when the red dots inside the mesh don’t.

0 votes
11k views

I’m implementing exporting charts. As part of my export, the user can specify the size of the chart. I’ve managed to get sciChartSurface.ExportToBitmapSource() working fine for single graphs.

However, I’ve got some quite complex layouts, and when I try to render parent controls that contain Scichart controls manually, with say:

ExportUIElement.Measure(size);
ExportUIElement.Arrange(new Rect(size));

 int dpiScaling = 3;
RenderTargetBitmap bmp = new RenderTargetBitmap(Width * dpiScaling, Height * dpiScaling,
                                                                                                           96 * dpiScaling, 96 * dpiScaling,
                                                                                                           PixelFormats.Pbgra32);

I’m finding everything working, the chart layout & axis/labels update and render fine, but the chart content is not re-rendered to the new size, causing some messy/strange visual effects. This one was arranged to a larger size, you can see that the actual chart content is now sitting snugly in the middle of a large margin:

enter image description here

Can I force Scichart to re-render these so I can manually render the component in a different size?

  • Ken Hobbs asked 7 years ago
  • last active 5 years ago
Showing 13 results

Try SciChart Today

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

Start TrialCase Studies