I'm using to Oxyplot for my Xamarin.iOS project for plotting a bar chart
This is what my plot currently looks like
Here I need to hide the Right and top axis
I tried :
model.Axes.Add(new LinearAxis()
{
Position = AxisPosition.Right,
IsAxisVisible = false
});
model.Axes.Add(new LinearAxis()
{
Position = AxisPosition.Top,
IsAxisVisible = false
});
But no effect.. Here's my full code
public MyClass()
{
var model = new PlotModel { Title = "ColumnSeries" };
// A ColumnSeries requires a CategoryAxis on the x-axis.
model.Axes.Add(new CategoryAxis()
{
Position = AxisPosition.Bottom,
MinorTickSize = 0,
//MajorGridlineStyle = LineStyle.Solid,
MinorGridlineStyle = LineStyle.Solid,
});
model.Axes.Add(new LinearAxis()
{
Position = AxisPosition.Left,
MinorTickSize = 0,
MajorGridlineStyle = LineStyle.Solid,
MinorGridlineStyle = LineStyle.Solid,
Minimum = 0,
Maximum = 400
});
model.Axes.Add(new LinearAxis()
{
Position = AxisPosition.Right,
IsAxisVisible = false
});
model.Axes.Add(new LinearAxis()
{
Position = AxisPosition.Top,
IsAxisVisible = false
});
var series = new ColumnSeries();
series.Items.Add(new ColumnItem() { Value = 200});
series.Items.Add(new ColumnItem(200));
series.Items.Add(new ColumnItem(300));
series.Items.Add(new ColumnItem(100));
series.Items.Add(new ColumnItem(200));
series.Items.Add(new ColumnItem(100));
series.Items.Add(new ColumnItem(130));
model.Series.Add(series);
this.MyModel = model;
}
How do I do it? Any help is appreciated....
Edit:
Also, In my chart above, why are the y labels not showing. How can I change the x labels like below... Is it possible to draw lines in this chart like below?
This is what I want my final graph to look like:
The problem is that the black border you are currently seeing is not the axis, is the plot area border, so you have to modify this property in the plotmodel:
And then, you have to add the AxisLineStyle to the axis that you want to draw(left and bottom), like this: