X axes label

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
saz
Posts: 4
Joined: Wed Mar 16, 2016 12:47 pm

X axes label

Post by saz » Sun Jun 19, 2016 8:20 am

I use "ExamplePersistentIntensitySignal" example (in DemoAppWPF) . but with my input data rather than SignalGenerator dataes.( my input data com from an event without of timing schedule and length double[1600].)
In this example we just insert y-data :

Code: Select all

//private PersistentSeriesRenderingIntensityLayer m_historicDataLayer;
		private void RenderTrace(double[] samples)
		{
			SampleDataSeries trace = m_chart.ViewXY.SampleDataSeries[0];
			if (m_historicDataLayer == null)
			{
				CreatePersistentLayer();
			}

			trace.SamplesDouble = samples;

			m_historicDataLayer.RenderSeries(trace);
		}
and x label adjust in :

Code: Select all

 m_chart.ViewXY.XAxes[0].FormatValueLabel += new AxisBase.FormatValueLabelHandler(ExamplePersistentIntensitySignal_FormatValueLabel);
		private string ExamplePersistentIntensitySignal_FormatValueLabel(AxisBase axis, double value)
		{
			// Convert seconds decimals into milliseconds in GUI.
			return (value * 1000.0).ToString("0");
		}
Now I want to set xlabel between [myMinX , myMaxX]. but i don't know in which way?
is it "value" in above function related to range of X axes or length of samples , "trace.SamplingFrequency" or other things? what is that exactly?

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

Re: X axes label

Post by ArctionKestutis » Tue Jun 21, 2016 8:20 am

PersistentSeriesRenderingIntensityLayer allows collecting traces into a layer, and coloring it by the hit count per pixel. The coloring is made by aid of value-range palette. The traces can be with same series types than in PersistentSeriesRenderingLayer, and is very much similar to it, main difference is the coloring. When rendering a trace in location of same pixel again with second rendering call, the intensity of it grows, so it gets higher value in the value-range palette.
The timing/schedule of update is not important: Chart is updated whenever there is call:

Code: Select all

m_historicDataLayer.RenderSeries(trace);
Therefore, if you add new ‘trace’ after each event it is perfectly fine.

If you want to create custom string from axis labels you could subscribe to FormatValueLabel event. The second argument (’value’), is referring to your axis value. In the example it will be Series.Points.x Note: there is slight change in event-handler argument type in version 7 of LightningChart.
However, there is no need to use this event handler. If it is ok to use x-values as it is, you can just write:

Code: Select all

m_chart.ViewXY.XAxes[0].LabelsNumberFormat = "0.0";
 m_chart.ViewXY.XAxes[0].ValueType = AxisValueType.Number;
Also, there is no need to use only SampleDataSeries as it is in the example. You could render a PointLineSeries, FreeformPointLineSeries, SampleDataSeries, HighLowSeries or AreaSeries to the persistent-layer by RenderSeries method.

You could set axis range with simple call already during chart creation (or at any later point):

Code: Select all

m_chart.ViewXY.XAxes[0].SetRange(myMinX, myMaxX);

Post Reply