Jump to content
Software FX Community

Is there a way to put a text item within an area graph? like a label


JP1970

Recommended Posts

Is it possible to put text into the middle of a area chart to label the area itself? In my example I would like to label the area chart as a 'baseline' - however I want that only in the area as I have x and y labels I need to use and it doesnt apply to the second series.

Thanks

JP

Link to comment
Share on other sites

We do not have a feature that will automatically put text into the middle of an area chart but we support an Annotation API that  allows you to add any visuals on top of the chart including text and "attach" it to an XY logical position, i.e. you do not have to worry about pixel positioning but you do have to provide X and Y positions in terms of your axes.

Note that an annotation is not currently tied to a specific series. In the following sample we are creating 3 rectangles (you can use TextBlocks instead), note the use of the attached properties to control where these items are displayed

Also note that you need to add a reference to ChartFX.WPF.Annotations

xmlns:cfxAnnotation="clr-namespace:ChartFX.WPF.Annotation;assembly=ChartFX.WPF.Annotation"

<

cfx:Chart Gallery="Line" x:Name="chart1">  <cfx:Chart.Extensions>   <cfxAnnotation:Annotations x:Name="annotations">   <Rectangle Width="80" Height="20" Fill="#80FF0000" cfxAnnotation:Annotations.AttachX="2" cfxAnnotation:Annotations.AttachY="40" HorizontalAlignment="Center"/>   <Rectangle Width="20" Height="20" Fill="LightBlue" Stroke="Black" Canvas.Right="10" Canvas.Top="10"/>   <Rectangle Fill="#8000FF00" cfxAnnotation:Annotations.AttachX="2" cfxAnnotation:Annotations.AttachY="65" HorizontalAlignment="Center" cfxAnnotation:Annotations.AttachWidth="1" Height="20" cfxAnnotation:Annotations.PaintBefore="true"/>   </cfxAnnotation:Annotations>  </cfx:Chart.Extensions></cfx:Chart>

Regards,

JuanC

Link to comment
Share on other sites

  • 1 month later...

Hi,

creating such annotations is nice, but it only works, if the plot has just one X and one Y axis.

In my plot I have two Y Axes. So, it does not work properly. The (in my case) textbox is not shown.

Is there a way to bind the X- and the Y- axis to the annotation?

Thx, Enrico.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...