How to control the display and hiding of legend by code?

Charts for WPF Forum

Posted 4 years ago by Yanggang Sha
Version: 19.1.0683
Avatar

MicroXYChart

How to control the display and hiding of legend by code? (Not by hovering the mouse)

Comments (7)

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Micro charts don't have a legend but full Charts do (you posted this in the full Charts forum).  Micro charts do have a tooltip that shows as you mouse over data values.

The legend in full Charts is the box that lists the series names and can be controlled with the XYChart.IsLegendvisible property.

But based on your question of mouse hovering (if you mean full Charts), perhaps you mean data point label display instead?  Each series has a LabelVisibility property that you can use to set several options like Visible (always) or PointerAxis (mouse-related).


Actipro Software Support

Posted 4 years ago by Yanggang Sha
Avatar

<microcharts:MicroXYChart IsHotTrackingEnabled="True" BorderThickness="0.5" YAxisMinimum="0" YAxisMaximum="100" XAxisMinimum="0" BorderBrush="Gray">
  <microcharts:MicroAreaSeries ItemsSource="{Binding Points}" XPath="CollectTime" YPath="Value1" StackKind="None" LegendStringFormat="{}{5}: Total: {0:N2}%" LineKind="Normal"/>
  <microcharts:MicroAreaSeries ItemsSource="{Binding Points}" XPath="CollectTime" YPath="Value2" StackKind="None" LegendStringFormat="{}{5}: Process: {0:N2}% {1:HH\:mm\:ss}" LineKind="Normal"/>
</microcharts:MicroXYChart>

-----------------------------------------------------------------------------------------------------------------------------------------------------

Is it possible to? Somehow dynamically display the LegendString(data point label) in the figure through coding, with the position and content to display dynamically controlled by specifying the value of XAxis in the code Note: Not to display the top content by hovering over the chart

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Thank you for the clarification.  Unfortunately not, the micro charts don't show a legend inline with the control itself since they are intended to be very small graphs that fit in grid cells.  They only show legend-like information in the hot-tracking tooltip if enabled.


Actipro Software Support

Posted 4 years ago by Yanggang Sha
Avatar

Is it possible to?How to do?

Call MicroXYChartPlotter.StartHotTracking()/UpdateHotTracking() through coding.

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

The hot-tracking tooltip is only opened during mouse enter events over the control and once opened, it is updated as mouse move and leave events are raised.  There isn't really any public programmatic access to it.

If you are looking to always display a legend, then perhaps it would be better to use full size Charts intead of Micro Charts?


Actipro Software Support

Posted 4 years ago by Yanggang Sha
Avatar

full size Charts? (charts:XYChart?)

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Yes, the XYChart control in the full-size Charts product is what I mean.


Actipro Software Support

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.