Jump to content
JChartFX Community
  • 0

LegendBox and MarkerStyle



Good morning,



for my application I want to change the marker within the legendbox to be a circle instead of a square. the chart c0 here is a pie chart.


Unfortunatly my code is not working.


Can you give me an advice?



                           var ia = c0.getLegendBox().getItemAttributes();
                           var ial = ia.getItemList(c0.getSeries());
Is it possible to style a custom marker? like a triangle...
the circle marker should have no border. Is this possible?


Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

(1) In a pie chart we do not show the collection of series in the legend box, instead we show the points which are represented in the API using the X axis, please change line 2 of your code as follows


var ial = ia.getItemList(c0.getAxisX());


(2) This is not possible in the current build, we support templates in most elements (galleries, titles, etc.) so in our next build we will support templates for the markers in the legend box, note that the XML we use is based on XAML but I am afraid is not documented anywhere.


In future builds you would use something like this



ial.setMarkerTemplate('<DataTemplate xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:sys="clr-namespace:System;assembly=mscorlib">' +
        '<DataTemplate.Resources>' +
            '<sys:Double x:Key="cfxOSW">1</sys:Double>' +
        '</DataTemplate.Resources>' +
        '<Viewbox ViewWidth="25" ViewHeight="25">' +
            '<Path Data="M12,0L24,24L0,24Z" Fill="{Binding Path=Fill}" Stroke="{Binding Path=Stroke}" />' +
        '</Viewbox>' +
(3) Same as 2, in future builds
ial.setMarkerTemplate('<DataTemplate>' +
'<Ellipse Fill="{Binding Path=Fill}"/>' +
Regards, JuanC
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.

Answer this question...

×   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...