Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
305
PCaps turn off and back on
posted

I currently have 2 charts that are using the same form. I need to turn off PCaps on each separately. My current code to turn off PCaps looks like this:

private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
{
List<Polyline> polyLines = new List<Polyline>();
foreach (var v in e.SceneGraph)
{
if (v is Polyline)
{
polyLines.Add(v as Polyline);
}

}

// here we are catching all lines except User Input line
if (polyLines.Count == 0)
{
return;
}

foreach (var polyLine in polyLines)
{
foreach (var point in polyLine.points)
{
// Chart 1
if (polyLines.Count == 12)
{
if (!(point.Row == 11))
{
point.Caps = PCaps.None;
}
}
// Chart 2
else
{
if (!(point.Row == 6) || !(point.Row == 7) || !(point.Row == 8) || !(point.Row == 9))
{

point.Caps = PCaps.None;
}
}
}
}
}

Right now it works fine for the first graph to take the PCaps off but when I go to the next chart the PCaps that should show up don't. Then when I go back to the first graph it also has taken the PCaps off for row 11.

Parents
No Data
Reply
  • 21795
    Verified Answer
    Offline posted

    Hello Amanda,

    If I understand you correctly you have one composite chart with two charts in it. First chart consists of 12 polylines and you need to set PCaps to none for each polyline except for the eleventh point. Up to this point you did it correctly in your code.

    For the second chart what I understand from your code is you probably need to set PCaps to none for each point except the sixth, the seventh, the eighth and the ninth. What you actually did with this logical statement:

    if (!(point.Row == 6) || !(point.Row == 7) || !(point.Row == 8) || !(point.Row == 9))

    is you are checking if point row is simultaneously equals to six, seven, eight or nine. At least three of these statements returns false every time. Then you set them to not and actually you finish with something like this:

    if (false || true || true || true)

    This statement returns true in whatever the input is. If you do need to set PCaps in second chart to none for all points except the sixth, the seventh, the eighth and the ninth you may try this:

    if ( point.Row != 6 && point.Row != 7 && point.Row != 8 && point.Row != 9)

    If you have a range of points in series you can try also this one:

    if ( 6 <= point.Row && point.Row <= 9)

    Also you could use switch operator like

    switch (point.Row)
       {
          {
              case 6:
              case 7:
              case 8:
              case 9:
                 {
                     break;
                  }
              default:
                 {
                      point.Caps = PCaps.None;
                      break;
                  }
       }

    Please let me know if this is what you are looking for or if I am missing something.

Children