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

Posted

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

Posted

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

  • 1 month later...
Posted

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.

 

Archived

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

×
×
  • Create New...