Jump to content
JChartFX Community
  • 0
Sign in to follow this  
jayman18

LegendBox and MarkerStyle

Question

jayman18    1

Good morning,

 

(1)

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());
                           ial.setMarkerShape(cfx.MarkerShape.Circle);
                           c0.getLegendBox().setVisible(true);
 
(2)
Is it possible to style a custom marker? like a triangle...
 
(3)
the circle marker should have no border. Is this possible?

post-47670-0-18635600-1467368193_thumb.png

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
JuanC    3

(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.setMarkerShape(cfx.MarkerShape.Template);

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>' +
    '</DataTemplate>');
 
(3) Same as 2, in future builds
 
ial.setMarkerShape(cfx.MarkerShape.Template);
ial.setMarkerTemplate('<DataTemplate>' +
'<Ellipse Fill="{Binding Path=Fill}"/>' +
'</DataTemplate>');
 
Regards, JuanC

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×