Strange behaviour with ScaleType Logarithmic

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
GeetaIfour
Posts: 2
Joined: Wed Jun 15, 2016 1:25 pm

Strange behaviour with ScaleType Logarithmic

Post by GeetaIfour » Wed Jun 15, 2016 1:40 pm

Hi,

I am using IntensityMeshSeries for display data and it's works fine with ScaleType = Linear.
While ScaleType changed from Linear to Logarithmic, On mouse hover of chart or drag axis of chart, IntensityMeshSeries data changed or behaviour of data changed.
Sample code for this added below.

Code: Select all

using System;
using System.Drawing;
using System.Windows.Forms;
using Arction.WinForms.Charting;
using Arction.WinForms.Charting.SeriesXY;

namespace ScaleTypeHeatMapExample
{
    public partial class Form1 : Form
    {
        private LightningChartUltimate m_chart;

        //Intesity mesh series
        private IntensityMeshSeries m_intensityMesh;

        public Form1()
        {
            InitializeComponent();
            CreateChart();
        }

        private void CreateChart()
        {
            m_chart = new LightningChartUltimate();
            m_chart.BeginUpdate();
            m_chart.Parent = panel1;
            m_chart.Dock = DockStyle.Fill;
            m_chart.ActiveView = ActiveView.ViewXY;

            m_chart.ViewXY.XAxes[0].ValueType = AxisValueType.Number;
            m_chart.ViewXY.XAxes[0].SetRange(0, 100);
            m_chart.ViewXY.YAxes[0].SetRange(0, 100);
            m_chart.ViewXY.YAxes[0].ScaleType = ScaleType.Logarithmic;
            m_chart.ViewXY.YAxes[0].LogLabelsType = LogLabelsType.Log10Exponential;

            m_intensityMesh = new IntensityMeshSeries(m_chart.ViewXY, m_chart.ViewXY.XAxes[0], m_chart.ViewXY.YAxes[0])
            {
                ContourLineType = ContourLineType.None,
                ContourLineStyle = { Width = 0 },
                Optimization = IntensitySeriesOptimization.StaticData,
                ShowNodes = false,
                WireframeType = SurfaceWireframeType.None,
                FullInterpolation = false,
                MouseHighlight = MouseOverHighlight.None
            };

            m_chart.ViewXY.IntensityMeshSeries.Add(m_intensityMesh);

            ValueRangePalette palette = new ValueRangePalette(m_intensityMesh);
            palette.Steps.Clear();
            palette.MinValue = 0;
            palette.Type = PaletteType.Gradient;
            palette.Steps.Add(new PaletteStep(palette, Color.Blue, 10));
            palette.Steps.Add(new PaletteStep(palette, Color.Green, 30));
            palette.Steps.Add(new PaletteStep(palette, Color.Yellow, 80));
            palette.Steps.Add(new PaletteStep(palette, Color.Red, 150));
            //and set to mesh
            m_intensityMesh.ValueRangePalette = palette;

            m_chart.EndUpdate();

            GenerateData();
        }

        private void GenerateData()
        {
            //Disable rendering, strongly recommended before updating chart properties
            m_chart.BeginUpdate();

            //Create a new data array 
            int iColumns = 100;
            int iRows = 100;
            IntensityPoint[,] data = new IntensityPoint[iColumns, iRows];

            //Generate some data 

            double dXMin = 0;
            double dXMax = 100;
            double dYMin = 0;
            double dYMax = 100;
            double dValueMin = 0;
            double dValueMax = 100;

            double dTotalX = dXMax - dXMin;
            double dTotalY = dYMax - dYMin;
            double dStepX = dTotalX / (double)iColumns;
            double dStepY = dTotalY / (double)iRows;

            double dCenterX = (dXMax + dXMin) / 2.0;

            double dBendAmplitude = 800 / (double)iRows * Math.Sin(31776 / 1000.0);
            double dIntensityAmplitude = 80.0 * Math.Sin(57000 / 2000.0);
            double dSideAttn = 1;

            double dY = dYMin;
            for (int iRow = 0; iRow < iRows; iRow++)
            {
                double dX = dXMin;
                for (int iCol = 0; iCol < iColumns; iCol++)
                {
                    dSideAttn = 1.0 - 2.0 * ((dCenterX - dX) / dTotalX) * ((dCenterX - dX) / dTotalX);

                    data[iCol, iRow].X = dX + dBendAmplitude * Math.Sin((double)iRow / 16.0);
                    data[iCol, iRow].Y = dY + dBendAmplitude * Math.Cos((double)iCol / 16.0);
                    data[iCol, iRow].Value = (dValueMax + dValueMin) / 2.0 + dIntensityAmplitude / 2.0 * Math.Sin(dX / 8.0) * Math.Sin(dY / 8.0) * dSideAttn + dY / 2;

                    dX += dStepX;
                }
                dY += dStepY;
            }

            m_intensityMesh.Data = data;

            //Allow chart rendering
            m_chart.EndUpdate();
        }
    }
}

Thanks!

ArctionKestutis
Posts: 555
Joined: Mon Mar 14, 2016 9:22 am

Re: Strange behaviour with ScaleType Logarithmic

Post by ArctionKestutis » Thu Jun 16, 2016 1:05 pm

Hi,
Thanks for the report. IntensitySeries should not behave like that. Our developers are investigating the issue.

GeetaIfour
Posts: 2
Joined: Wed Jun 15, 2016 1:25 pm

Re: Strange behaviour with ScaleType Logarithmic

Post by GeetaIfour » Mon Jun 20, 2016 4:43 am

Ok, Please add reply of this after investigating the issue.

Thank you.

ArctionKestutis
Posts: 555
Joined: Mon Mar 14, 2016 9:22 am

Re: Strange behaviour with ScaleType Logarithmic

Post by ArctionKestutis » Tue Jun 21, 2016 11:18 am

The issue was fixed. The fix will be available in the next release of v7 (probably in the next two weeks).

Post Reply