C #: How to cross bar in ASP.Net diagram

I have an asp.net graphical diagram that I am trying to add to one of the bars. I cannot figure out how to do this.

I want the crosshair of the 4th bar (left) in the chart. I tried the following code below but it doesn't work.

Chart1.Series["Actual"].Points[3].Color = ColorTranslator.FromHtml("#ffffff");
Chart1.Series["Actual"].Points[3].BorderColor = ColorTranslator.FromHtml("#d0d0d0");
Chart1.Series["Actual"].Points[3].BackSecondaryColor = ColorTranslator.FromHtml("#d0d0d0");
Chart1.Series["Actual"].Points[3].BackHatchStyle = ChartHatchStyle.LightUpwardDiagonal;

      

Can you tell me how to do this?

Andy

+2


source to share


1 answer


EDIT:

Using the code:

enter image description here

    protected void Page_Load(object sender, EventArgs e)
    {
        for (int x = 1; x <= 5; x++)
            Chart1.Series[0].Points.AddXY(x, 10 * x);

        Chart1.Series[0].Points[3].BackHatchStyle = ChartHatchStyle.Cross;
        Chart1.Series[0].Points[3].Color = Color.Orange;
    }

      




BackHatchStyle

should do this:

enter image description here

ASPX:

   <asp:Chart ID="Chart1" runat="server" Height="400px" Width="600px">
        <series>
            <asp:Series Name="Series1">
                <Points>
                    <asp:DataPoint XValue="1" YValues="10" />
                    <asp:DataPoint XValue="2" YValues="20" />
                    <asp:DataPoint XValue="3" YValues="30" />
                    <asp:DataPoint BackHatchStyle="WideUpwardDiagonal" Color="Red" XValue="4" YValues="40" />
                    <asp:DataPoint XValue="5" YValues="50" />
                </Points>
            </asp:Series>
        </series>
        <chartareas>
            <asp:ChartArea Name="ChartArea1">
            </asp:ChartArea>
        </chartareas>
    </asp:Chart>

      

0


source







All Articles