SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

1
0

I’m sorry I couldn’t attach images because of security.

Zoom out
VisibleRange X1 min VisibleRange X1 max
    +——————————–+ VisibleRange Y1 min
    |           |
    |           |
    |s=================e|
    |           |
    |           |
    +——————————–+ VisibleRange Y1 max

s : Point Start, e : Point End

In this state, Excute Zoom In Then “s====================e” disappears when the starting point is smaller than min and the end point is greater than max.

Zoom In : “s====================e” disappear
VisibleRange X2 min VisibleRange X2 max
    +——————————–+ VisibleRange Y2 min
    |           |
    |           |
    |           |
    |           |
    |           |
    +——————————–+ VisibleRange Y2 max

I want this chart
VisibleRange X1 min VisibleRange X1 max
    +——————————–+ VisibleRange Y2 min
    |           |
    |           |
    |===================|
    |           |
    |           |
    +——————————–+ VisibleRange Y2 max

How do I draw when a chart is not drawn at the location of a given data using “CustomRenderSeries”?
“====” is a BOX(Rectangle), not a line.

The program source used for coding.
I am currently using
renderableSeries.ResamplingMode = ResamplingMode.None;

// DataInsert.cs

var renderableSeries = new DieRenderableSeries(positionOfDie, _dieLayout);

foreach (var pl in _dieLayout.PlaneLayout._plane)
{
  Plane plane = pl.Value;
  foreach (var ba in plane._bank)
  {
    Bank bank = ba.Value;

    foreach (var matList in bank.NandMat)
    {
      var renderableSeries = new DieRenderableSeries(positionOfDie, _dieLayout);
      List<KeyValuePair<Point, Mat>> matDataList = new List<KeyValuePair<Point, Mat>>();

      foreach (var mat in matList)
      {
        mat.PointType = PointType.Start;
        matDataList.Add(new KeyValuePair<Point, Mat>(new Point(startX + mat.X1, startY + mat.Y1), mat));
      }

      var myList = matDataList.OrderBy(x => x.Key.X)
              .ThenBy(x => x.Key.Y)
               .ToList();

      var dataSeries = new MatDataSeries<double, double> { SeriesName = “Fault” };
      dataSeries.AcceptsUnsortedData = false;
      using (dataSeries.SuspendUpdates())
      {
        for (var i = 0; i < myList.Count(); i++)
        {
          Point myPoint = myList[i].Key;
          dataSeries.Append(myPoint.X, myPoint.Y, myList[i].Value);
        }
      }

      sciChart.RenderableSeries.Add(renderableSeries);
      renderableSeries.DieX = dieX;
      renderableSeries.DieY = dieY;
      renderableSeries.DataSeries = dataSeries;
      renderableSeries.CountOfRenderableSeries = dataSeries.Count;
      renderableSeries.ResamplingMode = ResamplingMode.None;
    }
  }
}

// CustomRenderableSeries.cs

for (var i = 0; i < _series.Count; i++)
{
  var data = renderPassData.PointSeries[i];
  var mat = (Mat)DataSeries.Metadata[data.Index];

  Point point = GetCoordinatesFor(data.X, data.Y);
  Point point2 = GetCoordinatesFor(data.X + mat.Width, data.Y + mat.Height);

  IBrush2D brush = _dicBrush[mat.TypeX];
  var pen = _bgndPens[mat.IsRedun && IsRedunVisibled ? 1 : 0];

  drawingHelper.DrawBox(point, point2, brush, pen, 0);
}

Version
v4.0.30319
  • You must to post comments
0
0

The reason why your line segment is disappearing when you zoom in, is because the series is being resampled, and points outside the viewport are being culled (removed).

The simplest way to solve this is to set ResamplingMode = ResamplingMode.None on the CustomRenderableSeries that you create. This will cause SciChart to draw all points.

However, there is a more complex way, and something that our own FastLineRenderableSeries does, is we implement a line clipping algorithm which cuts the line segment

S—————————————-E

into two extra points, lets call them

S———s1———–e1—————E

where s1, e1 are points located on the edge of the viewport. We use the Cohen-Sutherland line clipping algorithm to do this. To use this solution you’d need to write a lot more code, and actually we’d need to see a sample of your current code first to be able to help.

Let me know what you’d like to do. Solution (1) is very simple, solution (2) a lot harder, but provides higher performance.

Best regards,
Andrew

  • Andrew
    Hi Park, what does drawingHelper.DrawBox do? Are the points both outside the viewport? Maybe the problem is that the box needs to be clipped so that points are on the edge of the viewport (do a simple check if point X1 is outside left of the viewport, and X2 is outside right of the viewport, then set X1=0 and X2=Viewport.Width)
  • Park Geolgyu
    When I zoom in, the reenderPassData.PointSeries count changes. more zoom in, reenderPassData.PointSeries count becomes zero, so Draw() is not called. So, box is not drawn.
  • Andrew
    With resampling mode = none? I find that hard to believe! Can you send me a sample I can compile please? You can open a ticket on support desk so the attachment will be private. Best regards, Andrew
  • Park Geolgyu
    The entire source could not be upload due to security. However, the sample sources used are included in the questions above.(modified)
  • Andrew
    I’m sorry Park, but if the sample is not compilable, I can’t help you. We handle a lot of requests at SciChart, and not enough time to try to put together samples from snippets of code… See http://scichart.com/question-asking-guidelines for more info . Best regards, Andrew
Showing 1 result
Your Answer

Please first to submit.