Tag Archives: LightningChart.NET

How to solve the problem that lightningchart is completely black

LightningChart.net is fully GPU-accelerated and optimized for displaying massive amounts of data in real time — over 1 billion data points. LightningChart includes a wide range of 2D, Advanced 3D, Polar, Smith, 3D Pake/Doughnut, Geographic Maps and GIS charts as well as volume mapping capabilities for science, engineering, medicine, aviation, trade, energy and other fields.
LightningChart.net is now available for online order, SignalTools, 12 Months, WPF version for RMB3499 from RMB4105. Buy it now! Buy now> >
Click to download the latest trial version of LightningChart.NET
Question: With the WinForms program of LightningChart, for some reason I overwrite CreateParams in the Form class and put the LightingChart in the custom panel. Then the LightningChart will turn all black. Am I doing something wrong?The attached file demo project only overrides CreateParams and will show a black screen at startup and then go to the correct content, but in my program, it will always be black.
Start the

After normal startup for

Black

Lightning map all black
overwrites createParams code

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

We tried to reproduce this problem with the test items you shared, but were unable to produce a situation where the chart was completely black.
project has two forms, ReadData and Form1. Both can be added using CreateParams.
ReadData is black first and then displays the chart.

Form1 is first transparent and then displays the chart.

Did the problem occur in the test project on your computer?If so, will the chart display properly if you ignore createParams?This will indicate whether the reason is actually CreateParams.
The only known thing about a completely black chart is that it lacks some reference. In the test project, they seem to be correct, but just in case you can test adding arction.directXFiles.dll, directXInit.dll and arction.mathcore.dll.
As mentioned earlier, an all-black chart may appear if some references are missing. A complete reference list is provided in Chapter 29.1 of our user manual. All of these files are not necessarily needed at development time, for example, if DirectX-Files are already found somewhere on the computer. Referencing all listed parts solves the black chart problem.
However, if rendering DeviceType SoftwareD11 works, but Hardwared11 or Hardware D9 does not, then there may be a problem with the drivers themselves because they may be faulty or outdated. Therefore, it helps to update the driver to the latest version.
In general, you can listen to a ChartMessage-event immediately after building a LightningChart and call the checkEngineResult () – method in it to catch RenderingEngine errors. Such as:

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 did some more research on this issue and may have recreated it. When using CreateParams, does the following happen in the application?
After launching the application, WinForms controls such as buttons will be drawn, but the diagram will remain black (left image below). After a short time, the diagram is drawn (the image below is on the right).

What is the diagram behavior you are trying to accomplish?Should you draw both controls and charts?In this case, you will most likely have to defer the drawing of the control in some way. This can be done by rewriting the OnPaint method or by using SuspendLayout and Resumelayout. One solution, however, is to hide the control until the diagram 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 diagram. The sample code below shows all the buttons only after the diagram is drawn.
_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, please contact customer service for more information.