Sonagram View3d.Dimensions. Relating to the sonagram demo

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
greggorob64
Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

Sonagram View3d.Dimensions. Relating to the sonagram demo

Post by greggorob64 » Tue Mar 18, 2014 3:04 pm

I have a goal to stack multiple sonagram sufraces into the same chart.

As a newcomer to the charts, my first goal was this: I want a sonagram with no bottom axis, that uses 100% of the vertical space.

My starting point was the sonagram example, and I got to the 'MaximizeViewport' function.

I cant figure out what the dimension values actually are? They're not size in pixels, they're not starting XY in pixels, they're not percentages....

How do I say 'Maximize the vertical space completely'? (I have the axis invisible)

The function is:
const float XMarginPixels = 60f;
const float ZMarginPixels = 60f;
theChart.View3D.Dimensions.X = (float)theChart.View3D.Dimensions.Z / (((float)theChart.Width - 2f * ZMarginPixels) / ((float)theChart.Height - 2f * ZMarginPixels));
theChart.View3D.Dimensions.Z = 200f * ((float)theChart.Width - 2f * XMarginPixels) / (float)theChart.Width;

var str = string.Format("X is {0:00000}, Z is {1:00000}{2}", theChart.View3D.Dimensions.X, theChart.View3D.Dimensions.Z, Environment.NewLine);

Debugger.Log(0, "A", str);


I'm getting values like 40 for x, and 160. They seem to be correctly proportional.

A followup question: I would like my vertical axis to scale depending on the charts size. I want it to always display the same range of values, and it seems to be clipping the chart instead of scaling.

Thanks!

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Sonagram View3d.Dimensions. Relating to the sonagram de

Post by ArctionPasi » Tue Mar 18, 2014 6:34 pm

Spectrogram example is made with orthogonal top view of 3D chart. Dimensions values 3D world coordinates. Axes are stretched to be that long, they are kind of edge of a 3D cube.

When setting View3D.Dimensions.X = 200, it represents the full chart width.

For Dimensions.Z, set 200 * Chart.Height / Chart.Width to maximize it without borders.

Note, if you don't need a 3D presentation, please use ViewXY with IntensityGridSeries instead.

See this example:
WPF_Smooth1000x1000HeatmapScroll.zip
WPF heatmap chart scrolling
(27.18 KiB) Downloaded 669 times
LightningChart Support Team, PT

greggorob64
Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

Re: Sonagram View3d.Dimensions. Relating to the sonagram de

Post by greggorob64 » Wed Mar 19, 2014 1:12 pm

Thanks for the response. This is more from curiosity, but where does the number 200 come from?

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Sonagram View3d.Dimensions. Relating to the sonagram de

Post by ArctionPasi » Wed Mar 19, 2014 2:36 pm

If you are that curious to know :o , this is the projection matrix calculation routine inside LC.
void RebuildProjectionMatrix()
{
if (m_bOrthoCam)
{
m_projectionMtx = Matrix.OrthoLH(200, 200f / m_fWHAspectRatio, m_fNearClipDist, m_fFarClipDist);

}
else
{
m_projectionMtx = Matrix.PerspectiveFovLH(m_fFOV, m_fWHAspectRatio, m_fNearClipDist, m_fFarClipDist);
}
m_viewAndProjMtx = m_viewMtx * m_projectionMtx;
}

We had to select some value for ortho and we selected 200.
LightningChart Support Team, PT

Post Reply