ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Layer label isn't returning in all cases
Posted by James Johnson on Mar-13-2025 01:43
Greetings Peter -

  One quick question.  In one of our Charts we are plotting 5 sampling sites at one time. Every once in a while we see a legend icon (label) not moving to the next line (see attached image with arrow).

The symbols and string (here str1) are placed in the declaration of a layer as:

wt1layer.addDataSet(cWT1, &HCF4040, str1).setDataSymbol(Chart.CircleSymbol, 10)

And finally presented via a Legend box, q.v.,

            Dim Legend As LegendBox = c.addLegend(95, 560, 1, "Arial", 12)
            Legend.setBackground(Chart.Transparent, Chart.Transparent)
            Legend.setSize(700, 100)

What might cause an individual layer label to not return to the next line?

Thanks for any insights on this.  We have been trying to figure this out.  It occurs not in all charts but about 5% of them.

Jim

  Re: Layer label isn't returning in all cases
Posted by Peter Kwan on Mar-13-2025 02:52
Hi James,

For some reasons, I cannot see the attached image. Would you mind to try once more to attach the image?

In the Files To Upload field, after selecting the image, please remember to press the "Send File" button, otherwise the image will not be uploaded to the forum. Also, the image is limited to 250Kbytes. If you have larger image, you may email to me at pkwan@advsofteng.net

Your legend box code looks fine to me. It is layout vertically. There should be one legend entry per line unless the legend text is so long that it cannot fit the line. If this is not the case, is it possible there is another line of code somewhere that also configures the legend box but in a different way?

Best Regards
Peter Kwan

  Re: Layer label isn't returning in all cases
Posted by James Johnson on Mar-13-2025 05:28
Here's a link to the chart (at the top), legend just below chart.

https://auaww.azurewebsites.net/aww/DG/gwwMSSPc.aspx?ct=4&sitecode1=06005002&sitecode2=06005004&sitecode3=06005018&sitecode4=06005027&sitecode5=

  Re: Layer label isn't returning in all cases
Posted by Peter Kwan on Mar-13-2025 16:49
Hi James,

In your current chart, the legend box is flowing horizontally (from left to right, top to bottom) like text. The first two entries are in their own line because they are too long and cannot fit on one line, so the line "wraps" around. The last two entries are short enough so they can be put in one line.

Can you double check if the following code is the actual and only code that configures the legend box? Is it possible there is some duplicated code somewhere that configures the legend box differently?

Dim Legend As LegendBox = c.addLegend(95, 560, 1, "Arial", 12)
Legend.setBackground(Chart.Transparent, Chart.Transparent)
Legend.setSize(700, 100)

I ask because when I measure the chart, it seems the legend box is not at (95, 560). For testing, please modify the above to :

Dim Legend As LegendBox = c.addLegend(95, 560, True, "Times New Roman", 12)
Legend.setBackground(&HFFFF00, &HFF0000)
Legend.setSize(709, 157)

With the code above, the legend box is not transparent, so we can confirm where is the legend box. The size is changed to some unique numbers, so we can measure it to confirm the measurement is correct. Also, the font is different, which confirms it is using the new code.

Best Regards
Peter Kwan