Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Microsoft .Net & .Net Compact Framework
 QCChart2D and QCChart2D CF (VB and C#)
 Custom DataPoint Symbol
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jerzy

5 Posts

Posted - 12 Aug 2016 :  22:55:09  Show Profile  Reply with Quote
Hello forum members,

I am creating pump performance line plots. Many people in this industry use what looks like an inverted "L" to mark the design point instead of the triangles, stars, plusses, etc that are standard data point symbols in QCChart2D. Is there a way to create custom data point symbols? I have been experimenting with chart images and chart text objects. but have trouble getting the vertex of the symbol to coincide with the exact datapoint---my symbol usually ends up offset from datapoint location. Is there a way to create a custom data point symbol?

Thanks

Jerzy

quinncurtis

1551 Posts

Posted - 13 Aug 2016 :  12:26:45  Show Profile  Reply with Quote
Yes, you can create a custom shape. In general the symbol shapes are centered around the point (0.5, 0.5) in a symbol normalized coordinate system. The point in the symbol corresponding to (0.5, 0.5) is going to match the data point.

Define a simple custom shape class in you program, returning a GraphicsPath. The example below creates an inverted, left pointing, L. Since it is not closed, you should not try and fill it.

public GraphicsPath GetCustomShape()
{
GraphicsPath result = new GraphicsPath();
result.AddLine(1.0f, 0.5f, 0.5f, 0.5f);
result.AddLine(0.5f, 0.5f, 0.5f, 1.5f);
return result;
}

Then create a custom ChartSymbol using your custom shape. Set the SetCustomScatterPlotSymbol property of the SimpleScatterPlot object with the custom symbol.

ChartAttribute attrib3 = new ChartAttribute (Color.Red, 1,DashStyle.Solid);
attrib3.SetFillColor (Color.Red);
attrib3.SetFillFlag (false);
attrib3.SetSymbolSize(16);

SimpleScatterPlot thePlot3 = new SimpleScatterPlot(pTransform1, Dataset3, ChartObj.CIRCLE, attrib3);

ChartSymbol customSymbol = new ChartSymbol();
customSymbol.SetSymbolShape(GetCustomShape());

thePlot3.SetCustomScatterPlotSymbol(customSymbol);

chartVu.AddChartObject(thePlot3);
Go to Top of Page

jerzy

5 Posts

Posted - 14 Aug 2016 :  15:09:35  Show Profile  Reply with Quote
Dear Q-C,

Thank you so much! Worked perfectly. I am continually impressed with the quick and effective replies you give to questions. I pay well for support for some engineering programs and do not get the help you give for free. I have several of your packages and look to buy more. Again thanks and best regards to you and your fine company.

Jerzy
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07