![]() | Steema Issues DatabaseNote: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;otherwise you can use StackOverflow. Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy. |
| Summary: | Legend shows the wrong colours when there are more items than can show | ||
|---|---|---|---|
| Product: | Java TeeChart | Reporter: | slrworksv |
| Component: | Legend | Assignee: | Steema Issue Manager <issuemanager> |
| Status: | RESOLVED WORKSFORME | ||
| Severity: | major | CC: | sandra, yeray |
| Priority: | --- | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Chart Series: | --- | Delphi / C++ Builder RAD IDE Version: | |
| Attachments: | pictures showing wrong colours on legend when not all items fit in display. | ||
Have you reproduced the problem with SWT or Swing? We'd need a simple example project we can run as-is to reproduce the problem here. http://sscce.org/ Thanks in advance. Hello,
We can't reproduce the problem you're experiencing using the latest Teechart Java 3.2017.0622 Swing and the code below:
public class SwingTest
{
public static TChart tChart1 = new TChart();
static JPanel panel = new JPanel();
static JButton button1 = new JButton("Editor");
static Points series1;
static Area s;
public static void initializeChart()
{
Random rnd = new Random();
DateTime t = DateTime.getNow();
//AddColors
Color[] colors = new Color[30];
//AddColors Array
colors[0] = Color.fromArgb(247,168,141);// salmon
colors[1] = Color.BISQUE;
colors[2] = Color.BLACK;
colors[3] = Color.BLUE;
colors[4] = Color.CYAN;
colors[5] = Color.DARK_GRAY;
colors[6] = Color.FUCHSIA;
colors[7] = Color.GOLD;
colors[8] = Color.GRAY;
colors[9] = Color.GREEN;
colors[10] = Color.GREEN_YELLOW;
colors[11] = Color.INDIGO;
colors[12] = Color.fromArgb(4,92,89);//Dark-blue
colors[13] = Color.LIGHT_YELLOW;
colors[14] = Color.fromArgb(11,92,4);//Dark green
colors[15] = Color.fromArgb(175,141,247);//Dark Purple
colors[16] = Color.MAROON;
colors[17] = Color.NAVY;
colors[18] = Color.OLIVE;
colors[19] = Color.fromArgb(141,247,210);// green
colors[20] = Color.PINK;
colors[21] = Color.PURPLE;
colors[22] = Color.RED;
colors[23] = Color.SILVER;
colors[24] = Color.SKY_BLUE;
colors[25] = Color.TEAL;
colors[26] = Color.WHITE;
colors[27] = Color.WHITE_SMOKE;
colors[28] = Color.YELLOW;
colors[29] = Color.fromArgb(247,210,141);//Orange-Dark
//-------------------Application-------------------------------
tChart1.getAspect().setView3D(false);
tChart1.getLegend().setVisible(false);
panel.setBackground(Color.WHITE);
tChart1.setBackColor(Color.WHITE);
tChart1.getWalls().setVisible(false);
for (int i=0; i<10; i++)
{
s =new Area (tChart1.getChart());
s.getLinePen().setVisible(false);
s.getAreaLinesPen().setVisible(false);
for (int x=0; x<25; x++)
{
s.add(x,rnd.nextDouble());
}
s.setColor(colors[i]);
s.setMultiArea(MultiAreas.STACKED);
s.setTitle(s.titleOrName()+"_"+"abcdefghijklmnopqrstuvwxz");
}
tChart1.getLegend().setVisible(true);
tChart1.getLegend().setAlignment(LegendAlignment.BOTTOM);
tChart1.getLegend().getShadow().setVisible(false);
tChart1.getLegend().setMaxNumRows(2);
}
public static void main(String[] args)
{
// super.SwingTest();
// TODO code application logic here
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run()
{
initializeChart();
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(tChart1);
// panel.setSize(800, 650);
// tChart1.setSize(800,650);
f.setSize(650, 450);
// f.setLocation(200,200);
f.setVisible(true);
}
});
}
}
|
Created attachment 546 [details] pictures showing wrong colours on legend when not all items fit in display. Build 3.2014.1127 I have attached 2 pictures. The graph shows up to 30 items (29 individual items + 1 'everything else'). When there is not enough room in the legend to show all the items (when they have long text names for instance), they get cut off. Scroll bar would be nice here, but I understand that is coming. BUT the reason for filing this bug, is that the legend actually changes the colours of the series in the legend so they don't match the graph. We show largest first, so we have legend inverted true. See pic 1. Note that there are only 20 items showing in the legend because the text is so large for each name. Note that the colors of the legend items do not match the colors on the graph. The first one, Trojan cryptoblocker, should be navy - it is navy in the graph. Now see pic 2. As soon as I widen the graph enough to show all the series that SHOULD show in the legend.....the legend colours change to match the graph. We can live with the legend being cut off since they are at least seeing the 'top' X.... but having the wrong colours on the legend is not acceptable. Is there a fix for this or a workaround you can suggest? Thanks, Sally