Skip to content
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

How to change Waterfall Chart bar fill color. #37

Closed
gmcodebuster opened this issue Sep 17, 2018 · 2 comments
Closed

How to change Waterfall Chart bar fill color. #37

gmcodebuster opened this issue Sep 17, 2018 · 2 comments
Assignees

Comments

@gmcodebuster
Copy link

I want to set custom color into waterfall chart start, end, raise and fall bar. I could not find a way to set color to bar and in legend.
Need your help to set custom color in chart.

Thanking you.

@Shestac92 Shestac92 self-assigned this Sep 18, 2018
@ArsenyMalkov ArsenyMalkov self-assigned this Sep 18, 2018
@Shestac92
Copy link

@gmcodebuster
You can adjust the waterfall appearance like this:

AnyChartView anyChartView = findViewById(R.id.any_chart_view);

Waterfall waterfall = AnyChart.waterfall();

List<DataEntry> data = new ArrayList<>();
data.add(new ValueDataEntry("Start", 23));
data.add(new ValueDataEntry("Jan", 22));
data.add(new ValueDataEntry("Feb", -46));
data.add(new ValueDataEntry("Mar", -91));
data.add(new ValueDataEntry("Apr", 37));
data.add(new ValueDataEntry("May", -21));
data.add(new ValueDataEntry("Jun", 53));
data.add(new ValueDataEntry("Jul", 31));
data.add(new ValueDataEntry("Aug", -15));
data.add(new ValueDataEntry("Sep", 42));
data.add(new ValueDataEntry("Oct", 53));
data.add(new ValueDataEntry("Nov", -15));
data.add(new ValueDataEntry("Dec", 51));
DataEntry end = new DataEntry();
end.setValue("x", "End");
end.setValue("isTotal", true);
data.add(end);

Set set = Set.instantiate();
set.data(data);

com.anychart.core.waterfall.series.Waterfall series = waterfall.waterfall(set, "");

series.normal().fill("#ff6666 0.3");
series.normal().hatchFill("forward-diagonal", "#ff6666", 0.5, 10);
series.normal().stroke("#ff6666");
series.hovered().fill("#ff6666 0.1");
series.hovered().hatchFill("forward-diagonal", "#ff6666", 0.5, 10);
series.hovered().stroke("#ff6666 2");
series.selected().fill("#ff6666", 0.5);
series.selected().hatchFill("forward-diagonal", "#ff6666", 0.5, 10);
series.selected().stroke("#ff6666 4");

series.normal().fallingFill("#00cc99", 0.3);
series.normal().fallingStroke("#00cc99", 1, "10 5", "round", "null");
series.hovered().fallingFill("#00cc99", 0.1);
series.hovered().fallingStroke("#00cc99", 2, "10 5", "round", "null");
series.selected().fallingFill("#00cc99", 0.5);
series.selected().fallingStroke("#00cc99", 4, "10 5", "round", "null");

series.normal().risingFill("#0066cc", 0.3);
series.normal().risingStroke("#0066cc");
series.hovered().risingFill("#0066cc", 0.1);
series.hovered().risingStroke("#0066cc 2");
series.selected().risingFill("#0066cc", 0.5);
series.selected().risingStroke("#0066cc 4");

waterfall.title("Waterfall Chart: Appearance");

anyChartView.setChart(waterfall);

@gmcodebuster
Copy link
Author

Thank you for your prompt reply, Code works like charm.
I would like to know whether color setting code is documented in repository? If yes please share a link,
If not please add this code in sample example or in documentation so It will helpful to others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants