Duplicated color and marker shape after removing and adding series
Los mantenedores suelen responder en 4 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 67/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- java
- Área
- data-visualization
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Java
- Estrellas
- 1.6k
- Forks
- 400
- Merge medio
- 3 d 9 h
- PR fusionados (30 d)
- 7
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de knowm/XChart
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 4 días
-
Dificultad 3/5 1-2 días Aptitud para principiantes 57/100
Los mantenedores suelen responder en 4 días
-
Cleanup: generate axis ticks in-range instead of pruning after the fact (follow-up to #634)Posiblemente ocupada @Sinkleberg la tomó hace 20 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 4 días
-
`CategoryChart.addSeries` could support additional call signature for interoperability with ScalaPosiblemente ocupada @Sinkleberg la tomó hace 20 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
Los mantenedores suelen responder en 4 días
-
AnnotationsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
Los mantenedores suelen responder en 4 días
Todos los issues de knowm/XChart
Issues similares
-
documentation good first issue help wanted
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 2 días
-
bug key bindings
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día
-
Android Bug Core Drape
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
organicmaps/organicmaps#14449 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
openhab/openhab-addons#22512 ·
Los mantenedores suelen responder en 1 día