Jump to content
Software FX Community

Curve Issue


User (Legacy)

Recommended Posts

Using the ChartFx for .NET 6.2 Trial with Winforms; i'm trying to create a 

pump efficiency chart (parabolic fit)

All I did is:

Added a ChartFx Component to a new WinForm and added the following code in a

Button_Click event to create a sample chart.

private void button1_Click(object sender, System.EventArgs e)

{

chart1.Gallery = SoftwareFX.ChartFX.Gallery.Curve;

chart1.MarkerShape = SoftwareFX.ChartFX.MarkerShape.Many;

chart1.AxisY.Max = 110;

chart1.PointLabels = false;

chart1.Grid = SoftwareFX.ChartFX.ChartGrid.Vert |

SoftwareFX.ChartFX.ChartGrid.Horz ;

chart1.OpenData(SoftwareFX.ChartFX.COD.XValues, 1, 6);

chart1.XValue[0, 0] = 0;

chart1.XValue[0, 1] = 478;

chart1.XValue[0, 2] = 500;

chart1.XValue[0, 3] = 525;

chart1.XValue[0, 4] = 543;

chart1.XValue[0, 5] = 568;

chart1.CloseData(SoftwareFX.ChartFX.COD.XValues);

chart1.OpenData(SoftwareFX.ChartFX.COD.Values, 1, 6);

chart1.Value[0, 0] = 0;

chart1.Value[0, 1] = 66.0484330484331;

chart1.Value[0, 2] = 67.2140291847132;

chart1.Value[0, 3] = 67.5709996754301;

chart1.Value[0, 4] = 68.5768542534071;

chart1.Value[0, 5] = 68.5683547848685;

chart1.CloseData(SoftwareFX.ChartFX.COD.Values);

}

The attached JPG shows the chart created. I've edited the image to

highlight the problem area. It spikes between 2nd & 3rd points instead of

smoothing out.

I kindof understand why it is doing that - while there is a huge difference

between XValue[0] & XValue[1] there is very minimal difference between

XValue[1] to XValue[2] and also Value[1] & Value[2]. The component seems to

have difficulty interpolating the smooth fit that we can get by drawing the

curve manually.

Is there a way to get this to work correctly?

Any input is highly appreciated.

Thanks

Link to comment
Share on other sites

This is a bug in the .NET curve algorithm, we have a sample (attached) that 

shows a curve drawn using .NET, this sample does not use ChartFX , resizing

the window will exhibit the same behavior.

The only workaround would be to use a different algorithm we implemented in

our curve gallery. Note that because of the way we implemented this, you

will not get antialiasing.

chart1.Gallery = Gallery.Curve;

SoftwareFX.ChartFX.GalleryObj.Curve curve =

(SoftwareFX.ChartFX.GalleryObj.Curve) chart1.GalleryObj;

curve.Native = false;

--

JC

Software FX Support

"AnandCbe14" <anandcbe14@hotmail.com> wrote in message

news:uX1%23KRfBGHA.280@webserver3.softwarefx.com...

> Using the ChartFx for .NET 6.2 Trial with Winforms; i'm trying to create a

> pump efficiency chart (parabolic fit)

> All I did is:

> Added a ChartFx Component to a new WinForm and added the following code in

> a

> Button_Click event to create a sample chart.

>

> private void button1_Click(object sender, System.EventArgs e)

> {

> chart1.Gallery = SoftwareFX.ChartFX.Gallery.Curve;

> chart1.MarkerShape = SoftwareFX.ChartFX.MarkerShape.Many;

> chart1.AxisY.Max = 110;

> chart1.PointLabels = false;

> chart1.Grid = SoftwareFX.ChartFX.ChartGrid.Vert |

> SoftwareFX.ChartFX.ChartGrid.Horz ;

> chart1.OpenData(SoftwareFX.ChartFX.COD.XValues, 1, 6);

> chart1.XValue[0, 0] = 0;

> chart1.XValue[0, 1] = 478;

> chart1.XValue[0, 2] = 500;

> chart1.XValue[0, 3] = 525;

> chart1.XValue[0, 4] = 543;

> chart1.XValue[0, 5] = 568;

> chart1.CloseData(SoftwareFX.ChartFX.COD.XValues);

> chart1.OpenData(SoftwareFX.ChartFX.COD.Values, 1, 6);

> chart1.Value[0, 0] = 0;

> chart1.Value[0, 1] = 66.0484330484331;

> chart1.Value[0, 2] = 67.2140291847132;

> chart1.Value[0, 3] = 67.5709996754301;

> chart1.Value[0, 4] = 68.5768542534071;

> chart1.Value[0, 5] = 68.5683547848685;

> chart1.CloseData(SoftwareFX.ChartFX.COD.Values);

>

> }

>

> The attached JPG shows the chart created. I've edited the image to

> highlight the problem area. It spikes between 2nd & 3rd points instead of

> smoothing out.

> I kindof understand why it is doing that - while there is a huge

> difference

> between XValue[0] & XValue[1] there is very minimal difference between

> XValue[1] to XValue[2] and also Value[1] & Value[2]. The component seems

> to

> have difficulty interpolating the smooth fit that we can get by drawing

> the

> curve manually.

>

> Is there a way to get this to work correctly?

> Any input is highly appreciated.

>

> Thanks

>

>

>

post-2107-13922380923718_thumb.jpg

Link to comment
Share on other sites

  • 2 weeks later...

Excellent clarification

At the moment, I'll take a good curve fit instead of antialiasing

Thanks a lot for the alternate solution.

"Software FX Support" <none@noreply.com> wrote in message

news:P1B$idnBGHA.564@webserver3.softwarefx.com...

> This is a bug in the .NET curve algorithm, we have a sample (attached)

> that shows a curve drawn using .NET, this sample does not use ChartFX ,

> resizing the window will exhibit the same behavior.

>

> The only workaround would be to use a different algorithm we implemented

> in our curve gallery. Note that because of the way we implemented this,

> you will not get antialiasing.

>

> chart1.Gallery = Gallery.Curve;

> SoftwareFX.ChartFX.GalleryObj.Curve curve =

> (SoftwareFX.ChartFX.GalleryObj.Curve) chart1.GalleryObj;

> curve.Native = false;

>

> --

> JC

> Software FX Support

> "AnandCbe14" <anandcbe14@hotmail.com> wrote in message

> news:uX1%23KRfBGHA.280@webserver3.softwarefx.com...

>> Using the ChartFx for .NET 6.2 Trial with Winforms; i'm trying to create

>> a

>> pump efficiency chart (parabolic fit)

>> All I did is:

>> Added a ChartFx Component to a new WinForm and added the following code

>> in a

>> Button_Click event to create a sample chart.

>>

>> private void button1_Click(object sender, System.EventArgs e)

>> {

>> chart1.Gallery = SoftwareFX.ChartFX.Gallery.Curve;

>> chart1.MarkerShape = SoftwareFX.ChartFX.MarkerShape.Many;

>> chart1.AxisY.Max = 110;

>> chart1.PointLabels = false;

>> chart1.Grid = SoftwareFX.ChartFX.ChartGrid.Vert |

>> SoftwareFX.ChartFX.ChartGrid.Horz ;

>> chart1.OpenData(SoftwareFX.ChartFX.COD.XValues, 1, 6);

>> chart1.XValue[0, 0] = 0;

>> chart1.XValue[0, 1] = 478;

>> chart1.XValue[0, 2] = 500;

>> chart1.XValue[0, 3] = 525;

>> chart1.XValue[0, 4] = 543;

>> chart1.XValue[0, 5] = 568;

>> chart1.CloseData(SoftwareFX.ChartFX.COD.XValues);

>> chart1.OpenData(SoftwareFX.ChartFX.COD.Values, 1, 6);

>> chart1.Value[0, 0] = 0;

>> chart1.Value[0, 1] = 66.0484330484331;

>> chart1.Value[0, 2] = 67.2140291847132;

>> chart1.Value[0, 3] = 67.5709996754301;

>> chart1.Value[0, 4] = 68.5768542534071;

>> chart1.Value[0, 5] = 68.5683547848685;

>> chart1.CloseData(SoftwareFX.ChartFX.COD.Values);

>>

>> }

>>

>> The attached JPG shows the chart created. I've edited the image to

>> highlight the problem area. It spikes between 2nd & 3rd points instead

>> of

>> smoothing out.

>> I kindof understand why it is doing that - while there is a huge

>> difference

>> between XValue[0] & XValue[1] there is very minimal difference between

>> XValue[1] to XValue[2] and also Value[1] & Value[2]. The component seems

>> to

>> have difficulty interpolating the smooth fit that we can get by drawing

>> the

>> curve manually.

>>

>> Is there a way to get this to work correctly?

>> Any input is highly appreciated.

>>

>> Thanks

>>

>>

>>

>

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...