-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select dataset color #264
Comments
Hey there, I hope this helps and please let us know why it didn't work in the first place. PS: If you want to different default colors, you can look at |
I've just tried An interesting thing is that, previously, I called both Here is the code that works for me: DefaultDataSet dataSet = new DefaultDataSet(feature.toString());
dataSet.setStyle("strokeColor=black");
for (DataPoint dataPoint : chromatogram.getDataPoints()) {
double retTime = dataPoint.getRetTime();
double intensity = dataPoint.getIntensity();
dataSet.add(retTime, intensity);
} However, if I add DefaultDataSet dataSet = new DefaultDataSet(feature.toString());
dataSet.setStyle("strokeColor=black");
for (DataPoint dataPoint : chromatogram.getDataPoints()) {
int index = dataSet.getDataCount();
double retTime = dataPoint.getRetTime();
double intensity = dataPoint.getIntensity();
dataSet.add(index, retTime, intensity);
dataSet.addDataStyle(index, "strokeColor=black;");
} Here is the error:
It looks like I'm missing SLF4J dependency. But I do have Here is a part of my pom.xml file:
|
This error is independent of styling, we are using |
Thank you for the explanation. I see that slf4j-api v2 is still in alpha, so I'd rather stay on version 1.7.30 for now. I'll just try to avoid any logging in ChartFX. |
Dear @asmirn1, why use I try to get more insights about
|
Renderer renderer = new CandleStickRenderer(true); |
Lines 51 to 59 in ed86318
protected void prepareRenderers(XYChart chart, OhlcvDataSet ohlcvDataSet, DefaultDataSet indiSet) { | |
// create and apply renderers | |
var candleStickRenderer = new CandleStickRenderer(true); | |
candleStickRenderer.getDatasets().addAll(ohlcvDataSet); | |
var avgRenderer = new ErrorDataSetRenderer(); | |
avgRenderer.setDrawMarker(false); | |
avgRenderer.setErrorStyle(ErrorStyle.NONE); | |
avgRenderer.getDatasets().addAll(indiSet); |
while
DefaultDataSet
's role in following seems trivial:Lines 162 to 169 in ed86318
protected void prepareRenderers(XYChart chart, OhlcvDataSet ohlcvDataSet, DefaultDataSet indiSet) { | |
// create and apply renderers | |
Renderer renderer = new CandleStickRenderer(true); | |
renderer.getDatasets().addAll(ohlcvDataSet); | |
chart.getRenderers().clear(); | |
chart.getRenderers().add(renderer); | |
} |
as well as
Line 209 in ed86318
indiSet = new DefaultDataSet("MA(24)"); |
Line 255 in ed86318
prepareRenderers(chart, ohlcvDataSet, indiSet); |
Instead of DefaultDataSet
, I indeed see many examples using DefaultDataSet
but DefaultDataSet
not all the way the only DataSet
appeared on examples.
chart-fx/chartfx-samples/src/main/java/io/fair_acc/sample/chart/SimpleChartSample.java
Line 14 in ed86318
import io.fair_acc.dataset.spi.DoubleDataSet; |
chart-fx/chartfx-samples/src/main/java/io/fair_acc/sample/dataset/FloatToDoubleBenchmarkSample.java
Line 8 in ed86318
import io.fair_acc.dataset.spi.FloatDataSet; |
chart-fx/chartfx-samples/src/main/java/io/fair_acc/sample/chart/CustomFragmentedRendererSample.java
Line 18 in ed86318
import io.fair_acc.dataset.spi.FragmentedDataSet; |
while general declaration/ definition are here. Similar question is asked #527.
I'm not sure i understand the problem and how it is related to this issue. As explained in its javadoc, Also please don't post your question to multiple long-closed issues, but rather open a new issue or in this case better a discussion thread as it does not seem to be a bug-report that we can solve in chartfx. You can always link to the issues from there. Also try to explain what you are trying to do. |
Dear @wirew0rm , |
It's probably not a bug. I just want to ask a question:
By default, the first dataset is drawn blue, the second is red, the third is green, etc. I would like to draw some of the datasets completely black/gray. I was able to change the color of markers with
dataset.setDataStyle()
, but I don't understand how to change the color of lines.I've tried
dataset.setStyle("-fx-stroke: black")
,dataset.setStyle("strokeColor=black")
, anddataset.addDataStyle(index, "strokeColor=black")
, but nothing worked for me.Here, I'm using
DefaultDataSet
andErrorDataSetRenderer
.What is the correct way to change the color of a dataset?
The text was updated successfully, but these errors were encountered: