Profile Picture

Chart-Legend with no borders

Posted By joern kunze 2 Years Ago
Author
Message
joern kunze
Question Posted 2 Years Ago
View Quick Profile
Junior Member

Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)

Group: Forum Members
Last Active: 3 Months Ago
Posts: 86, Visits: 221
Hi Experts,
I have created a manual legend for a chart - which basically is working:


But I have 2 problems:

1. How can I set the border lines around the legend to none ?
=> there is only oLegend.BorderStyle property - but I could not find a way to change this property to 'NoBorder'

2. Can I format the Legend entry text in a way that I can set Numbers subscript ?



The desired result should look then like (picture created with paint-app):


Thanks for your help,
best regards,
Joern


joern kunze
Posted 2 Years Ago
View Quick Profile
Junior Member

Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)

Group: Forum Members
Last Active: 3 Months Ago
Posts: 86, Visits: 221
... unfortunatly, I posted this question under 'NOV Chart for NET' - actually the question relates to  'Nevron Chart for Net'. Could the admin please move the question to the appropriate section ?
Best regards, Joern

Nevron Support
Posted 2 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hi Joern,

No problem about the post. You can turn off the legend borders using:

   NLegend legend = nChartControl1.Legends[0];


    legend.OuterBottomBorderStyle.Width = new Nevron.GraphicsCore.NLength(0);
    legend.OuterTopBorderStyle.Width = new Nevron.GraphicsCore.NLength(0);
    legend.OuterLeftBorderStyle.Width = new Nevron.GraphicsCore.NLength(0);
    legend.OuterRightBorderStyle.Width = new Nevron.GraphicsCore.NLength(0);

Regarding the subscript, yes this is possible - you need to set the text format to XML and then enclose the subscript text with sub tags:
   NChart chart = nChartControl1.Charts[0];

    NBarSeries bar = new NBarSeries();
    bar.Values.Add(10);
    bar.Values.Add(20);
    bar.Values.Add(30);

    bar.Name = "Subscript <sub>text</sub>";
    bar.Legend.TextStyle.TextFormat = Nevron.GraphicsCore.TextFormat.XML;

    chart.Series.Add(bar);

We hope this helps - let us know if you meet any problems.



Best Regards,
Nevron Support Team



joern kunze
Posted 2 Years Ago
View Quick Profile
Junior Member

Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)

Group: Forum Members
Last Active: 3 Months Ago
Posts: 86, Visits: 221
Hi Experts,
thanks a lot for the quick response - unfortunatly, when I apply the code example, only the outer border disappears:

 How can I force the remaining border lines between the legend entries to disappear ?


About the subscribed text for a legend entry:
The legend itself is created in manual mode without any reference to the displayed serie:


So unfortunatly, the suggested approach did not work. Is there a way to make the entry text with subscript even when the legend is created completly in manual mode ( sometimes just the chart with the legend and without any data series might be displayed) ?

Thanks again a lot for your help,
Best regards,
Joern


Nevron Support
Posted 2 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hi Joern,

Regarding the legend - to turn off the legend grid lines you can use:
   legend.HorizontalBorderStyle.Width = new NLength(0);
    legend.VerticalBorderStyle.Width = new NLength(0);

As for the legend items text - you need to switch the text mode to XML for each legend item cell data:

someData.TextStyle.TextFormat = TextFormat.XML;

Then you can use XML formatting to apply subscript and superscript text. 
Let us know if you meet any problems or have any questions.



Best Regards,
Nevron Support Team



joern kunze
Posted 2 Years Ago
View Quick Profile
Junior Member

Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)

Group: Forum Members
Last Active: 3 Months Ago
Posts: 86, Visits: 221
... thank you so much - works perfectly now :-)




Similar Topics


Reading This Topic