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!
Sonagram View3d.Dimensions. Relating to the sonagram demo
Moderator: Queue Moderators
-
- Posts: 183
- Joined: Tue Mar 18, 2014 2:55 pm
- ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
- Contact:
Re: Sonagram View3d.Dimensions. Relating to the sonagram de
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:
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:
LightningChart Support Team, PT
-
- Posts: 183
- Joined: Tue Mar 18, 2014 2:55 pm
Re: Sonagram View3d.Dimensions. Relating to the sonagram de
Thanks for the response. This is more from curiosity, but where does the number 200 come from?
- ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
- Contact:
Re: Sonagram View3d.Dimensions. Relating to the sonagram de
If you are that curious to know , 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.
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