Profile Picture

Problem with FindValue

Posted By Bhumi Patel 12 Years Ago
Author
Message
Bhumi Patel
Posted 12 Years Ago
View Quick Profile
Forum Member

Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 33, Visits: 1
Hi All,

I have a bar chart with around 200 points. And I would like to highlight some points if they go down under certain value. I am using following line of code to find a bar:

int barIndex = in_barSeries.XValues.FindValue(Convert.ToDouble(dataset.Tables[0].Rows[index]["YValue"]));

This function is working fine. But my problem is, I have all the bars with nearly same values. So, if I do a FindValue, it doesn't always finds a right bar. It finds a bar that comes first in the series with the same value.

Please help me with this problem!!

Thanks,
Bhumi

Nevron Support
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Bhumi,

In this case a simple loop trough the values will do the job - for example:

  private List<int> GetBarIndicesBelowValue(NBarSeries bar, double value)
  {
   NDataSeriesDouble values = bar.Values;
   int count = values.Count;
   List<int> barIndices = new List<int>();
   for (int i = 0; i < count; i++)
   {
    if ((double)values[i] < value)
    {
     barIndices.Add(i);
    }
   }

   return barIndices;
  }

returns a list of all bar indices that have a Y value below the specified one.



Best Regards,
Nevron Support Team



Bhumi Patel
Posted 12 Years Ago
View Quick Profile
Forum Member

Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 33, Visits: 1
Thank you for your reply!! It worked seamlessly!!



Similar Topics


Reading This Topic