Duplicated color and marker shape after removing and adding series
I maintainer di solito rispondono entro 4 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 67/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- java
- Ambito
- data-visualization
Direzione di ricerca
Start by tracing XYChart.removeSeries and XYChart.addSeries, then inspect how the chart assigns colors and marker shapes when a series is added. Reproduce the sequence in the issue with series A, B, C, then remove A and B while adding D and E. Done means C, D, and E retain distinct colors and marker shapes after repainting.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
Removing any serie except last from XYChart and adding that one serie once again or any other serie causes duplication of color and marker shape with original last serie.
To Reproduce
Steps to reproduce:
Create XYChart.
Add series A,B, C
Repaint chart.
Remove serie A
Add serie D
Repaint chart
Remove serie B
Add serie E
Repaint chart.
Result: All series C, D, E have the same color and marker shape - incorrect.
Sample chart code:
package example;
import java.awt.BorderLayout;
import java.text.ParseException;
import javax.swing.JFrame;
import org.knowm.xchart.XChartPanel;
import org.knowm.xchart.XYChart;
import org.knowm.xchart.XYChartBuilder;
public class XChartBugDuplicatedColorAndMarker extends JFrame{
private static final long serialVersionUID = 1L;
double[] xValuesA = new double[] {10, 20, 30};
double[] yValuesA = new double[] {10, 20, 30};
double[] xValuesB = new double[] {11, 21, 31};
double[] yValuesB = new double[] {10, 20, 30};
double[] xValuesC = new double[] {12, 22, 32};
double[] yValuesC = new double[] {10, 20, 30};
double[] xValuesD = new double[] {13, 23, 33};
double[] yValuesD = new double[] {10, 20, 30};
double[] xValuesE = new double[] {14, 24, 34};
double[] yValuesE = new double[] {10, 20, 30};
private XYChart chart;
XChartPanel<XYChart> chartPanel;
public static void main(String[] args) throws ParseException {
XChartBugDuplicatedColorAndMarker app = new XChartBugDuplicatedColorAndMarker();
app.setSize(600,400);
app.setVisible(true);
app.replaceSeries();
}
public void replaceSeries() {
Runnable r = new Runnable() {
@Override
public void run() {
try {
Thread.sleep(2000);
chart.removeSeries("A");
chart.addSeries("D", xValuesD, yValuesD);
chartPanel.repaint();;
Thread.sleep(2000);
chart.removeSeries("B");
chart.addSeries("E", xValuesE, yValuesE);
chartPanel.repaint();
}
catch(InterruptedException ie) {
return;
}
}
};
new Thread(r).start();
}
public XChartBugDuplicatedColorAndMarker() {
chart = getXYChart();
chartPanel = new XChartPanel<>(chart);
setLayout(new BorderLayout());
add(chartPanel, BorderLayout.CENTER);
}
public XYChart getXYChart() {
XYChart chart =
new XYChartBuilder()
.width(720)
.height(480)
.title("Duplicated color and marker shape after remove and add serie")
.xAxisTitle("Count")
.yAxisTitle("Value")
.build();
chart.addSeries("A", xValuesA, yValuesA);
chart.addSeries("B", xValuesB, yValuesB);
chart.addSeries("C", xValuesC, yValuesC);
return chart;
}
}
Screenshots
Before removing and adding series:
After removing and adding series (duplicated colors and marker shapes for D and E - the same as for C):
Expected behavior
Series C, D, E have different colors and marker shapes
- Lingua principale
- Java
- Stelle
- 1.6k
- Fork
- 400
- Merge medio
- 3g 9h
- PR unite (30g)
- 7
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di knowm/XChart
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 57/100
I maintainer di solito rispondono entro 4 giorni
-
Cleanup: generate axis ticks in-range instead of pruning after the fact (follow-up to #634)Forse già presa @Sinkleberg l’ha presa 20 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 4 giorni
-
`CategoryChart.addSeries` could support additional call signature for interoperability with ScalaForse già presa @Sinkleberg l’ha presa 20 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
I maintainer di solito rispondono entro 4 giorni
-
AnnotationsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
I maintainer di solito rispondono entro 4 giorni
Tutte le issue di knowm/XChart
Issue simili
-
documentation good first issue help wanted
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 2 giorni
-
bug key bindings
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
Android Bug Core Drape
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
organicmaps/organicmaps#14449 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
openhab/openhab-addons#22512 ·
I maintainer di solito rispondono entro 1 giorno