Created
February 14, 2018 07:04
-
-
Save ArsenyMalkov/928776f69596da771d2781e64912d19b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PolarChartActivity extends AppCompatActivity { | |
private ChartsPolar polar; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_chart_common); | |
AnyChartView anyChartView = findViewById(R.id.any_chart_view); | |
polar = AnyChart.polar(); | |
createSeries(new ValueDataEntry("Growth", 100)); | |
createSeries(new ValueDataEntry("Turnaround", 70)); | |
createSeries(new ValueDataEntry("Operational Delivery", 45)); | |
createSeries(new ValueDataEntry("Start-Up", 40)); | |
createSeries(new ValueDataEntry("Financial Accountability", 40)); | |
createSeries(new ValueDataEntry("International Experience", 40)); | |
createSeries(new ValueDataEntry("Restructure", 40)); | |
createSeries(new ValueDataEntry("Change Management", 40)); | |
createSeries(new ValueDataEntry("People Management", 40)); | |
createSeries(new ValueDataEntry("Special Project", 40)); | |
polar.setYGrid(false); | |
polar.getYScale() | |
.setMaximum(100) | |
.setMinimum(0); | |
polar.setDefaultSeriesType(PolarSeriesType.COLUMN) | |
.setYAxis(false) | |
.setXScale(ScaleTypes.ORDINAL); | |
anyChartView.setChart(polar); | |
} | |
private PolarSeriesColumn createSeries(ValueDataEntry dataEntry) { | |
List<DataEntry> data = new ArrayList<>(); | |
data.add(dataEntry); | |
PolarSeriesColumn series = polar.column(data); | |
series.setPointWidth("97%"); | |
return series; | |
} | |
} |
@achinverma You should indicate fields to return. A ValueDataEntry class has two fields which are "x" and "value".
Here is an example:
polar.setOnClickListener(new ListenersInterface.OnClickListener(new String[]{"x", "value"}) {
@Override
public void onClick(Event event) {
event.getData().get("x");
event.getData().get("value");
}
});
@Shestac92 thanks for your reply 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Shestac92 thanks, one point, is there any listener available for this polar chart, I mean to say whenever I click on a particular section can I get the position or the value in that section?
i have used below but i am getting null event.getData();