Hi,
I observed a weird behavior with custom pointmarkers in SciChart. The issue is related to the previous one I reported, so I will not post my code snippets here, because it’s actually the same code as in the link. However, it is a different kind of issue, so I thought I should start a new thread.
Description (I attached a .gif to illustrate the issue):
Inside my RenderSurface, I have some pointmarkers which are filled with a transparent color and others which are filled with the color of the stroke of this pointmarker. Whether or not the pointmarker is filled depends on the IPointMetaData object attached to the point (and the meta data won’t change in any way).
When the chart gets displayed I have 4 pointmarkers visible. All 4 are filled, BUT only the leftmost SHOULD be filled. When I now scroll the chart to the right so that the leftmost pointmarker is not visible anymore the 3 remaining pointmarkers lose their fill and are now displayed as they should. Scrolling the first one back in the get filled again. I can only assume that this is maybe caused by SciChart cacheing some resources internally?
Important: I did only observe this issue with the Direct3D10RenderSurface. Everything works as expected with the other three surface types.
Edit:
seems like the gif animation does not work, so I added two more pictures.
DiaryPointMarker.cs
public class DiaryPointMarker : BasePointMarker
{
private IList<IPointMetadata> _dataPointMetadata;
IList<int> _dataPointIndexes = new List<int>();
private readonly List<Point> _points = new List<Point>();
public bool UseClustering { get; set; }
public bool IndicateCommentWithFill { get; set; }
private IPen2D _lowStrokePen;
private IPen2D _midStrokePen;
private IPen2D _highStrokePen;
private IBrush2D _lowRatingColor;
private IBrush2D _midRatingColor;
private IBrush2D _highRatingColor;
private IBrush2D _noCommentColor;
public Brush LowRatingColor { get; set; }
public Brush MidRatingColor { get; set; }
public Brush HighRatingColor { get; set; }
public override void BeginBatch(IRenderContext2D context, Color? strokeColor, Color? fillColor)
{
_dataPointMetadata = RenderableSeries.DataSeries.Metadata;
_dataPointIndexes = new List<int>();
_points.Clear();
base.BeginBatch(context, strokeColor, fillColor);
}
public override void MoveTo(IRenderContext2D context, double x, double y, int index)
{
if (IsInBounds(x, y))
{
_dataPointIndexes.Add(index);
_points.Add(new Point(x,y));
}
if (UseClustering)
{
base.MoveTo(context,x,y,index);
}
}
public override void EndBatch(IRenderContext2D context)
{
if (UseClustering)
{
base.EndBatch(context);
}
else
{
Draw(context, _points);
context.SetPrimitvesCachingEnabled(false);
}
}
public override void Draw(IRenderContext2D context, IEnumerable<Point> centers)
{
TryCasheResources(context);
var markerLocations = centers.ToArray();
for (int i = 0; i < markerLocations.Length; ++i)
{
var diaryMetaInfo = _dataPointMetadata[_dataPointIndexes[i]] as DiaryPointMetaData;
var center = markerLocations[i];
var strokePen = diaryMetaInfo.Rating < 60
? _lowStrokePen
: diaryMetaInfo.Rating < 80 ? _midStrokePen : _highStrokePen;
var fillBrush = diaryMetaInfo.Rating < 60
? _lowRatingColor
: diaryMetaInfo.Rating < 80 ? _midRatingColor : _highRatingColor;
context.DrawEllipse(
strokePen,
IndicateCommentWithFill ? (String.IsNullOrEmpty(diaryMetaInfo.Comment) ? _noCommentColor : fillBrush) : fillBrush,
center,
Width,
Height
);
}
}
private void TryCasheResources(IRenderContext2D context)
{
_lowStrokePen = _lowStrokePen ?? context.CreatePen(LowRatingColor.ExtractColor(), AntiAliasing, (float)StrokeThickness, Opacity);
_midStrokePen = _midStrokePen ?? context.CreatePen(MidRatingColor.ExtractColor(), AntiAliasing, (float)StrokeThickness, Opacity);
_highStrokePen = _highStrokePen ?? context.CreatePen(HighRatingColor.ExtractColor(), AntiAliasing, (float)StrokeThickness, Opacity);
_lowRatingColor = _lowRatingColor ?? context.CreateBrush(LowRatingColor);
_midRatingColor = _midRatingColor ?? context.CreateBrush(MidRatingColor);
_highRatingColor = _highRatingColor ?? context.CreateBrush(HighRatingColor);
_noCommentColor = _noCommentColor ?? context.CreateBrush(Color.FromArgb(0, 0, 0, 0));
}
}
- Andreas Haas asked 8 years ago
- last edited 8 years ago
- You must login to post comments
I am considering applying server-side licensing for my javerScript application.
In the document below, there is a phrase “Our server-side licensing component is written in C++.”
(https://support-dev.scichart.com/index.php?/Knowledgebase/Article/View/17256/42/)
However, there is only asp.net sample code on the provided github.
(https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-dotnet-server-licensing)
I wonder if there is a sample code implemented in C++ for server-side licensing.
Can you provide c++ sample code?
Also, are there any examples to run on Ubuntu?
- Andrew Burnett-Thompson answered 8 years ago
-
Just tried it. Looks good! Thank you :)
- You must login to post comments
Hi Matthias,
We had an issue with forums not downloading attachments. Our dev team is working on this now…
In the meantime, I have seen your gif (retrieved from server :)) and dont know what’s causing it.
You mention you are using a custom point marker. Perhaps you can share the code for that pointmarker here?
Best regards,
Andrew
- Andrew Burnett-Thompson answered 8 years ago
-
Hi Andrew, the code for the custom point marker is the one Yuriy here (Yuriys answer did solve my first issue, but not the one described here): https://www.scichart.com/questions/question/issue-with-tightly-arranged-pointmarkers The strange thing is, that this issue only occurs with the Direct3D10RenderSurface. Therefor, as a workaround, I currently use the HighQualityRenderSurface, but the performance benefits of the Direct3D10RenderSurface would be nice ;)
-
Yes we discussed this issue last week together. Basically SciChart PointMarker Clustering (enabled by default, cannot be disabled) is likely causing the issue you see. What we need is a full code sample which we can download and just run … Too much forum context switching + email + chatter makes it hard to solve this problem. So … how can we reproduce this? Just download and run the solution in https://www.scichart.com/questions/question/issue-with-tightly-arranged-pointmarkers ?
-
I prepared a minimal sample project for you, but when I try to upload the .zip file I just get a “Forbidden” notification in the browser. Should I send it over via email?
- You must login to post comments
Please login first to submit.