Skip to content

Commit 58b640d

Browse files
committed
Added bar borders to the demo
1 parent 18e3923 commit 58b640d

8 files changed

Lines changed: 53 additions & 0 deletions

File tree

‎MPChartExample/res/menu/bar.xml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,9 @@
4141
android:id="@+id/actionToggleAutoScaleMinMax"
4242
android:title="Toggle auto scale min/max">
4343
</item>
44+
<item
45+
android:id="@+id/actionToggleBarBorders"
46+
android:title="Show Bar Borders">
47+
</item>
4448

4549
</menu>

‎MPChartExample/src/com/xxmassdeveloper/mpchartexample/AnotherBarActivity.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
126126
mChart.notifyDataSetChanged();
127127
break;
128128
}
129+
case R.id.actionToggleBarBorders: {
130+
for (IBarDataSet set : mChart.getData().getDataSets())
131+
((BarDataSet)set).setBarBorderWidth(set.getBarBorderWidth() == 1.f ? 0.f : 1.f);
132+
133+
mChart.invalidate();
134+
break;
135+
}
129136
case R.id.actionToggleHighlightArrow: {
130137
if (mChart.isDrawHighlightArrowEnabled())
131138
mChart.setDrawHighlightArrow(false);

‎MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivity.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
167167
mChart.notifyDataSetChanged();
168168
break;
169169
}
170+
case R.id.actionToggleBarBorders: {
171+
for (IBarDataSet set : mChart.getData().getDataSets())
172+
((BarDataSet)set).setBarBorderWidth(set.getBarBorderWidth() == 1.f ? 0.f : 1.f);
173+
174+
mChart.invalidate();
175+
break;
176+
}
170177
case R.id.actionToggleHighlightArrow: {
171178
if (mChart.isDrawHighlightArrowEnabled())
172179
mChart.setDrawHighlightArrow(false);

‎MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivityMultiDataset.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
135135
mChart.notifyDataSetChanged();
136136
break;
137137
}
138+
case R.id.actionToggleBarBorders: {
139+
for (IBarDataSet set : mChart.getData().getDataSets())
140+
((BarDataSet)set).setBarBorderWidth(set.getBarBorderWidth() == 1.f ? 0.f : 1.f);
141+
142+
mChart.invalidate();
143+
break;
144+
}
138145
case R.id.actionToggleHighlight: {
139146
if(mChart.getData() != null) {
140147
mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());

‎MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivitySinus.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
151151
mChart.notifyDataSetChanged();
152152
break;
153153
}
154+
case R.id.actionToggleBarBorders: {
155+
for (IBarDataSet set : mChart.getData().getDataSets())
156+
((BarDataSet)set).setBarBorderWidth(set.getBarBorderWidth() == 1.f ? 0.f : 1.f);
157+
158+
mChart.invalidate();
159+
break;
160+
}
154161
case R.id.actionToggleHighlightArrow: {
155162
if (mChart.isDrawHighlightArrowEnabled())
156163
mChart.setDrawHighlightArrow(false);

‎MPChartExample/src/com/xxmassdeveloper/mpchartexample/HorizontalBarChartActivity.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
169169
mChart.notifyDataSetChanged();
170170
break;
171171
}
172+
case R.id.actionToggleBarBorders: {
173+
for (IBarDataSet set : mChart.getData().getDataSets())
174+
((BarDataSet)set).setBarBorderWidth(set.getBarBorderWidth() == 1.f ? 0.f : 1.f);
175+
176+
mChart.invalidate();
177+
break;
178+
}
172179
case R.id.actionToggleHighlightArrow: {
173180
if (mChart.isDrawHighlightArrowEnabled())
174181
mChart.setDrawHighlightArrow(false);

‎MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivity.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
140140
mChart.notifyDataSetChanged();
141141
break;
142142
}
143+
case R.id.actionToggleBarBorders: {
144+
for (IBarDataSet set : mChart.getData().getDataSets())
145+
((BarDataSet)set).setBarBorderWidth(set.getBarBorderWidth() == 1.f ? 0.f : 1.f);
146+
147+
mChart.invalidate();
148+
break;
149+
}
143150
case R.id.actionToggleHighlightArrow: {
144151
if (mChart.isDrawHighlightArrowEnabled())
145152
mChart.setDrawHighlightArrow(false);

‎MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivityNegative.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
154154
mChart.notifyDataSetChanged();
155155
break;
156156
}
157+
case R.id.actionToggleBarBorders: {
158+
for (IBarDataSet set : mChart.getData().getDataSets())
159+
((BarDataSet)set).setBarBorderWidth(set.getBarBorderWidth() == 1.f ? 0.f : 1.f);
160+
161+
mChart.invalidate();
162+
break;
163+
}
157164
case R.id.actionToggleHighlightArrow: {
158165
if (mChart.isDrawHighlightArrowEnabled())
159166
mChart.setDrawHighlightArrow(false);

0 commit comments

Comments
 (0)