How to solve the problem that the lightning graph appears completely black in LightningChart

LightningChart.NET is fully GPU accelerated and optimized for performance, which can be used to display massive amounts of data in real time-over 1 billion data points. LightningChart includes a wide range of 2D, advanced 3D, Polar, Smith, 3D pie/donuts, geographic maps and GIS charts, as well as volume rendering functions suitable for science, engineering, medicine, aviation, trade, energy and other fields.

LightningChart.NET has now been added to the online ordering. SignalTools, 12 months, WPF version was originally priced at 4105 yuan, and the current price is only 3499 yuan. Buy now and enjoy the discount! Buy now>>

Click to download the latest trial version of LightningChart.NET

Question: Using the winforms program of LightningChart, for some reason I overwrite the CreateParams in the Form class and put the LightingChart in the custom panel, and then LightningChart will become completely black. Am I doing something wrong? The attached file demo project only covers CreateParams, and will show a black screen at startup, and then go to the correct content, but in my program, it has always been a black screen.

start up
å ›¾ç ‰ ‡

After normal startup, it is

å ›¾ç ‰ ‡

black
å ›¾ç ‰ ‡

Re: The lightning diagram is all black,
covering the code of CreateParams

protected override CreateParams CreateParams
{
    
    
    get
    {
    
    
        CreateParams cp = base.CreateParams;
        cp.ExStyle |= 0x02000000;
        return cp;
    }
}

We tried to reproduce this problem through the test project you shared, but we were unable to produce a completely black chart.
There are two forms in the project, ReadData and Form1. Both can be added using CreateParams.

ReadData is first in black, and then the chart is displayed.

读数据

Form1 is first transparent, and then displays the chart.
Insert picture description here

Did the problem occur in the test project on your computer? If so, then if you omit CreateParams, can the chart be displayed normally? This will show whether the cause is actually CreateParams.

The only known case of a completely black picture is the lack of some references. In the test project, they seem to be correct, but just in case you can test add Arction.DirectXFiles.dll, DirectXInit.dll and Arction.MathCore.dll.

As mentioned earlier, if some references are missing, a completely black chart may appear. Chapter 29.1 of our user manual provides a complete reference list. During development, all these files are not necessarily required, for example, if DirectX-files have been found somewhere in the computer. Quoting all the parts listed can solve the black picture problem.

However, if rendering DeviceType SoftwareD11 works, but HardwareD11 or Hardware D9 does not work, there may be a problem with the driver itself because they may be buggy or out of date. Therefore, updating the driver to the latest version will help.

Usually, you can listen to the ChartMessage-event immediately after constructing the LightningChart and call the CheckEngineResult()-method in it to catch RenderingEngine errors. E.g:

private void _chart_ChartMessage(ChartMessageInfo info)
        {
    
    
            info.ToString(); //= log message
 
            if (info.MessageType == MessageType.RenderDeviceCreateFailed || info.MessageType == MessageType.MemoryAllocationError)
            {
    
    
                CheckEngineResult();
            }
       }
 
 
private void CheckEngineResult()
        {
    
    
            var results = _chart.GetLastEngineInitResults();
 
            foreach (var engineInitResult in results)
            {
    
    
                string sLog = string.Format("Engine {0}. Success:{1}", engineInitResult.DeviceType, engineInitResult.Success);
 
                foreach (var exception in engineInitResult.Exceptions)
                {
    
    
                    sLog = string.Format("{0}\n Exception: {1}", sLog, exception.Message);
                }
                System.Diagnostics.Debug.WriteLine(sLog);
            }
       }

We have investigated this issue more and it is possible that the issue has been reproduced. When using CreateParams, did the following happen in the application?
After starting the application, WinForms controls such as buttons will be drawn, but the chart is still black (left image below). After a short time, a chart will be drawn (the picture below is the right picture).

BlackChart.png

What is the chart behavior you want to complete? Should I draw controls and charts at the same time? In this case, you will most likely have to delay the drawing of the control in some way. This can be done by overriding the OnPaint method or using SuspendLayout and ResumeLayout. However, one solution is to hide the controls until the chart is drawn. In other words, set the Visible property of all controls to false by default, and then set it to true in the Paint event of the chart. The following sample code displays all buttons only after drawing the chart.
_chart.Paint += _chart_Paint;

private void _chart_Paint(object sender, PaintEventArgs e)
{
    _chart.Paint -= _chart_Paint; // Do this only once.
    foreach (var b in this.Controls.OfType<Button>())
    {
        b.Visible = true;
    }
}

If you have any questions about this, please contact customer service for more information.

Guess you like

Origin blog.csdn.net/RoffeyYang/article/details/113593185