I want to create horizontal lines at multiples, 10 for example. At any given starting and ending point. I also do not want to be able to select these horizontal lines. I have solved both problems but there is likely a better way of achieving this.
The main problem I have now and where I need assistance is that I can't change the styling of the horizontal lines in the chart indicator menu.
In the second picture I have shown what the indicator menu in the chart looks like. So I could manually go in and alter all the stylings individually but this really isn't feasible of course. So in my current situation I would have to save multiple versions of this indicator with the different stylings when I would like to be able to just use templates. The first picture shows basically what I want with the horizontal line on 4000 and the horizontal lines on multiples of 10 with different stylings. I just would like to be able to style these directly through the indicators chart menu and not only through code.
I have stripped down the code but it is very basic.
public static int NumberOfLines;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Multiple = 10;
Start = 10;
End = 1000;
NumberOfLines = (int) ((End - Start) / Multiple);
// Generate Hori zontal line plots
for(int i = 0; i <= NumberOfLines; i++) {
AddPlot(new Stroke(Brushes.DimGray, DashStyleHelper.Solid, 1, 40), PlotStyle.HLine, "myplot" + i.ToString());
}
}
else if (State == State.Configure)
{
}
}
// Makes the horizontal bars generated unselectable
protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
{
if(!IsInHitTest)
base.OnRender(chartControl, chartScale);
}
//gives the horizontal bars their y axis values
protected override void OnBarUpdate()
{
for(int i = 0; i <= NumberOfLines; i++) {
Values[i][0] = Start + Multiple*i;
}
}

Comment