Hello,
thx for the reply. I tries somethijng similar even before going to the forum. I created another DataSeries (phantomLine) and gave it transparent as color. The behavoir of the chart then is really strange:
// Horizontal Axis
LinearAxis horAx = new LinearAxis();
horAx.Minimum = _minX; // minStrike
horAx.Maximum = _maxX; //maxStrike
horAx.MajorStep = Math.Round((ulPrice * 0.03), 0);
horAx.Title = "Underlying Price";
horAx.Font = new System.Drawing.Font("Ubuntu", 10F, FontStyle.Bold);
// Secondary x-axis with percent values of current price
LinearAxis horAx2 = new LinearAxis();
horAx2.VerticalLocation = AxisVerticalLocation.Bottom;
horAx2.Minimum = Math.Round(_minX / ulPrice, 4);
horAx2.Maximum = Math.Round(_maxX / ulPrice, 4);
horAx2.Title = "Strike Moneyness";
horAx2.MajorStep = Math.Round(ulPrice * 0.03 / ulPrice, 4);
horAx2.Font = new System.Drawing.Font("Ubuntu", 10F, System.Drawing.FontStyle.Bold);
foreach (Line l in _drawnLines)
{
ScatterLineSeries sls = l.sls;
sls.PointSize = new SizeF(1, 1);
sls.BorderColor = l.color;
sls.ForeColor = l.color;
sls.BackColor = l.color;
sls.BorderWidth = 3;
if (l.name == "DTE 0")
{
sls.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
}
else
{
sls.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
}
sls.LegendTitle = l.name;
if (sls.Name == "phantomLine2")
{
sls.HorizontalAxis = horAx2;
}
else
{
sls.HorizontalAxis = horAx;
}
rcv.Series.Add(sls);
}
// Vertical Axis
LinearAxis verAx = rcv.Axes.Get<
LinearAxis
>(1); //.Axes.Get<
LinearAxis
>(1);
verAx.Minimum = _minY; // - 1000;
verAx.Maximum = _maxY; // + 1000;
verAx.Title = "P&L";
verAx.MajorStep = Math.Round(Math.Max(Math.Abs(_minY), Math.Abs(_maxY)) * 0.1, 0);
verAx.LabelFormat = "{0:N}";
verAx.Font = new System.Drawing.Font("Ubuntu", 10F, FontStyle.Bold);
This leads to an annoying graph which moves(!) in the upper direction AND still does not show the second x-axis (see pic1)...
To show you what I want: this is a similar task with a relativel similar code and it works fine:
LinearAxis horAx = new LinearAxis(); // radChartView1.Axes.Get<
LinearAxis
>(0);
horAx.Minimum = minX;
horAx.Maximum = maxX;
horAx.MajorStep = Math.Round((ulPrice * 0.03), 2);
horAx.Title = "Strike";
horAx.Font = new System.Drawing.Font("Ubuntu", 12F, System.Drawing.FontStyle.Bold);
ivCallRaw.HorizontalAxis = horAx;
ivPutRaw.HorizontalAxis = horAx;
LinearAxis horAx2 = new LinearAxis();
horAx2.VerticalLocation = AxisVerticalLocation.Bottom;
horAx2.Minimum = Math.Round(minX / ulPrice, 4);
horAx2.Maximum = Math.Round(maxX / ulPrice, 4);
horAx2.Title = "Strike Moneyness";
horAx2.MajorStep = Math.Round(ulPrice * 0.03 / ulPrice, 4) ;
horAx2.Font = new System.Drawing.Font("Ubuntu", 12F, System.Drawing.FontStyle.Bold);
ivCallMoneyness.HorizontalAxis = horAx2;
radChartView1.Series.Add(ivCallRaw);
radChartView1.Series.Add(ivCallMoneyness);
radChartView1.Series.Add(ivPutRaw);
LinearAxis verAx = radChartView1.Axes.Get<
LinearAxis
>(1);
verAx.Minimum = Math.Round(Math.Min(minCallIv, minPutIv), 0) - 2;
verAx.Maximum = Math.Round(Math.Max(maxCallIv, maxPutIv), 0) + 2;
verAx.Title = "Implied Volatility %";
verAx.MajorStep = Math.Round(verAx.Maximum * 0.1, 0);
verAx.LabelFormat = "{0:N}";
verAx.Font = new System.Drawing.Font("Ubuntu", 12F, System.Drawing.FontStyle.Bold);
and this leads to this graph aka two x-axis (pic2)
I spend hours with this issue now and would really thankful for help, but also would like to mention that this functionality is not sufficiently documented. In the doc are very short three examples which do not help me regarding this. Is there another you could recommend me for issues like this. Nevertheless, for the short-term your help would be highly appreciated
Thank you
Patrick