This is the discussion forum for OxyPlot.
For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!

Clustered Column Chart - How to change distance between groups?

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

WiseDeveloper wrote at 2014-01-14 11:42:

First of all, thank you for such a GREAT Charting Library.

I am creating a Clustered Column Chart. I find that the distance between the groups (distance between the bunch) cannot be altered. As a result, the columns are thinner as we go on adding column series.

Please help.

objo wrote at 2014-01-14 20:05:

The CategoryAxis has a GapWidth property, see the ColumnSeries -> GapWidth examples in the ExampleBrowser. Does this do what you need?

WiseDeveloper wrote at 2014-01-15 18:50:

Dear objo,

Thank you very much for the reply.

This does what I want. Setting a value of 0.25 gives ample space for the clustered columns.

Thank you very much for the help.

I have a couple of issues with the column series. I have put it in a separate thread. Please help.

HeatMap Color Bar

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

jfraschilla wrote at 2013-08-20 21:41:

How can I get the HeatMap color bar to have a larger width and displayed to the right of the main image with an offset (aka MATLAB)

objo wrote at 2013-08-22 21:40:

The width of the ColorAxis is determined by the inherited MajorTickSize property. I guess we should change this to make it more clear.
I don't think it is possible to add offset in the current implementation. But StartPosition and EndPosition should work, if you want to make it shorter.
I would also like to see more positioning options like the legend box - e.g. inside the plot area.
https://oxyplot.codeplex.com/workitem/10072

jfraschilla wrote at 2013-08-23 04:15:

Thanks for the help

Seconds display problem

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

trustmeiamjedi wrote at 2014-01-31 16:49:

Hi!
I'm trying to screen date and time axis where MajorStep - is minutes, and MinorStep - is the interval in 5 sec.
For this I use the following code:
        plotModel = new PlotModel
        {
            IsLegendVisible = false
        };
        dateAxis = new DateTimeAxis(AxisPosition.Bottom, "Time", "HH:mm")
        {
            MajorGridlineStyle = LineStyle.Solid,
            MinorGridlineStyle = LineStyle.Dot,
            IntervalLength = 80,
            IntervalType = DateTimeIntervalType.Minutes,
            MajorStep = 1d/ 1440d,
            MinorStep = 1d / 1440d /6d,
            MinorIntervalType = DateTimeIntervalType.Seconds,
            Minimum = DateTimeAxis.ToDouble(DateTime.Now),
            Maximum = DateTimeAxis.ToDouble(DateTime.Now.AddMinutes(10)),
            IsZoomEnabled = false,
            IsPanEnabled = false,
        };
        plotModel.Axes.Add(dateAxis);
But as a result some ticks for seconds are not displayed. See the picture below:

Image

Does anybody know how to solve this problem?

I would highly appreciate any assist.
Thanks!

trustmeiamjedi wrote at 2014-02-01 08:05:

I have found an easy way how to solve this problem.
In class DateTimeAxis I've corrected the value TimeOrigin from DateTime(1900, 1, 1, 0, 0, 0, DateTimeKind.Utc)
to DateTime(2000, 1, 1, 1, 1, 1, DateTimeKind.Utc) and the error was eliminated.
I hope this info will be useful for somebody!

Annotation Problem

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

Death69 wrote at 2014-07-24 10:47:

Hi,
it's me again^^ I have a problem with Annotations.
I need 4 annotations for my plot, 2 RectangleAnnotations and 2 Arrowannotations. The Arrow Annotations working fine, but the rectangle Annotation is somehow weird.
You can look at the problem on the screenshot i provided.

Here is my code for the Rectangle Annotations:
var recAnnotation1 = new RectangleAnnotation();
            recAnnotation1.MinimumX = 0;
            recAnnotation1.MinimumY = 0;
            recAnnotation1.MaximumY = listItem[listItem.Count - 1].WealthList;
            recAnnotation1.Fill = OxyColor.FromArgb(99, 255, 0, 0); ;

            var recAnnotation2 = new RectangleAnnotation();
            recAnnotation1.MinimumY = 0;
            recAnnotation2.MinimumX = 0;
            listItem.Sort(delegate(ListCarrier l1, ListCarrier l2) { return l1.WealthList.CompareTo(l2.WealthList); });
            recAnnotation2.MaximumY = listItem[listItem.Count - 1].WealthList;
            recAnnotation2.Fill = OxyColor.FromArgb(99, 0, 128, 0);

            temp.Series.Add(ls);
            temp.Annotations.Add(recAnnotation2);
            temp.Annotations.Add(recAnnotation1);
Here's the screenshot:
http://imgur.com/GpBUlRv

//Edit: Ok I'm just blind and should name my variables correctly... If you wan't you can delete this discussion...

Exception raised on the designer

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

Gimly wrote at 2013-12-05 10:58:

I don't know if it's an issue on my machine or something that came with the latest version of Oxyplot on Nuget, but something is crashing the designer as soon as I add a Plot to the XAML.

I get the following exception:
Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. 
The system cannot find the file specified.
Any clue where that could be coming from?

objo wrote at 2013-12-06 18:25:

I tried to use the latest WPF Nuget package with VS 2013 and did not see any exceptions. What version are you using, and do you have the latest updates?

VadimCh wrote at 2013-12-07 03:02:

I have the same problem. All updates installed. I am using 2013.2.136.1 version.
When I am not using Nuget and connect source project directly - disigner worked.
Blend for Visual Studio 2013 crashing in any case.

Gimly wrote at 2013-12-09 08:27:

I'm using the latest version of OxyPlot and VS 2012 Update 4.

It's actually kind of strange, because it was working OK, and I started a new project, got OxyPlot from NuGet and in that new project I got the exception for the first time.

Then, I opened another project which and it crashed with the same exception, even though I hadn't updated the library. I tried updating, but no luck yet. It's not a big issue for me as it just crashes the designer, but I'd like to know where it's coming from.

VadimCh wrote at 2013-12-09 13:10:

Afte updates vs 2013 installation with install "silverlight sdk" all working good.
About vs 2012. Repair installation. It helped me.

Gimly wrote at 2013-12-10 14:52:

Just a quick update, I did a repair like VadimCh suggested and it indeed fixed the issue.

A bit weird, maybe an update for VS screwed something up. Anyway, I don't have the exception anymore.

Thanks!

badbadboy wrote at 2014-03-05 14:04:

I can confirm that for VS2013 installing Silverlight SDK fixed the issue (as VadimCh kindly pointed out).
I had VS2013 update 1, but that was not enough.

iOS - Can't Add PlotView via AddSubview

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

benhysell wrote at 2014-03-12 23:55:

I'm curious why this doesn't work...

Say I'm in a class that is a UIViewController, I would expect I could do the following:
var plot = new PlotView ();
plot.Model = graph.Plot;
plot.BackgroundColor = UIColor.Red;
this.View.AddSubview(plot);
This will not show the plot, however if I do
this.View = plot
The plot shows up fine.

I would have expected I could call AddSubView(plot) and it would have worked.

Where I'm running into problems is I have a UIViewController that I'm adding to another UIViewController using AddChildViewController...and my plot won't render.

Thoughts?

objo wrote at 2014-03-13 07:04:

Sorry, I don´t know the answer. I would like to know too!

The control was refactored using the example in
http://docs.xamarin.com/guides/ios/user_interface/designer/ios_designable_controls_walkthrough/
with the goal to also make it usable from the Xamarin Studio designer.

benhysell wrote at 2014-03-13 14:12:

I'll see if I can take a look and figure out what is going on, can you create an issue in the issue tracker to track this?

benhysell wrote at 2014-03-14 01:12:

I think I found the answer...I do not believe this is a bug, but feedback is welcome.

Take the code in the ExampleBrowser for iOS
private void GraphView(ExampleInfo exampleInfo)
{
    var dvc = new GraphViewController (exampleInfo);
    navigation.PushViewController (dvc, true);
}
What I was attempting to do in my app was to take a UIViewController and add it to a second UIViewController, an allowed operation I believe, by doing the following
private void GraphView(ExampleInfo exampleInfo)
{
    var dvc = new GraphViewController (exampleInfo);
    var newGraphViewController = new UIViewController ();   
    newGraphViewController.AddChildViewController (dvc);
    newGraphViewController.View.AddSubview (dvc.View);
    navigation.PushViewController (newGraphViewController, true);
}
The above produced an empty view, nothing to show on the screen. The reason is, when dvc calls LoadView() the View.Frame of dvc is 0,0,0,0, the frame has no position and no size.

To properly get this to work one needs to manually set the View.Frame of the child UIViewController. The following code works fine:
private void GraphView(ExampleInfo exampleInfo)
{
    var dvc = new GraphViewController (exampleInfo);
    var newGraphViewController = new UIViewController ();
    dvc.View.Frame = newGraphViewController.View.Frame;
    newGraphViewController.AddChildViewController (dvc);
    newGraphViewController.View.AddSubview (dvc.View);
    navigation.PushViewController (newGraphViewController, true);
}
Not a bug, I believe this is as designed by iOS.

Where can I find "PlotView.TouchEvents.cs"?

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

Neocosmical wrote at 2014-06-03 06:09:

I'm using OxyPlot-2014.1.312.1 with VS2012 Update4 and .NET Framework 4.0, WPF.
I've added a oxy:PlotView in xmal. When I debug the app on a Surface and touch on the PlotView, an exception came out and ask me to find "PlotView.TouchEvents.cs". Where can I find it?

objo wrote at 2014-06-06 20:59:

The file should be in Source/OxyPlot.Wpf. Let us know if you find a bug!

Showing Line at 0 point of X Axis

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

codertuhin wrote at 2014-06-21 23:42:

Hello,
First of all thanks a lot for making such an awesome control for free.

I would like to show a horizontal line at 0 point of X Axis just as the red line in the following image.

Image

Could anybody please help me in this issue? I'd be very grateful!

Thanks.

Death69 wrote at 2014-06-23 08:08:

Set this:
        youraxisname.MajorGridlineStyle = LineStyle.Solid;
        youraxisname.MinorGridlineStyle = LineStyle.None;
this way you get all the majorgridlines.

codertuhin wrote at 2014-06-24 04:07:

Thanks for your great help. It works!

ArrowAnnotations color

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

Gala wrote at 2014-06-11 14:33:

Hello) Can anybody help me? I' m using oxyPlot for my wpf project, and i'm trying to display a lot of arrows with different colors.
  var arrow = new ArrowAnnotation();
  arrow .Text = number.ToString();
  if (number < 2) 
                    arrow .Color = OxyColors.Green;
   else 
                     arrow .Color = OxyColors.Red;
  arrow.StartPoint =  point + 5;
  arrow.EndPoint = point;
  arrow.YAxisKey = "Spread";
  SpreadModel.Annotations.Add(arrow);
The variable - number is always different, but arrows are always the same color(depends of what number was the last).
Thanks

Plot Precision

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

CaulynDarr wrote at 2013-09-03 16:10:

I recently inherited some code that uses OxyPlot, and am having some issues displaying plot points accurately.

I think the problem has to do with the precision of the points being plotted versus the scale of the plot area. The items being displayed are supposed to be 1 unit apart. and approximately a third of a unit in thickness. But when they are displayed, sometimes there is a gap between the plotted items, and sometimes they touch or overlap. My axis are usually 100 units.

When I multiply the values I'm plotting by two, the spacing appears evened out. The spacing also appears better when I enlarge the plot area.

Is there a way to control the plotting precision while keeping the same axis scaling?

objo wrote at 2013-09-04 19:52:

On what platform are you seeing this problem? wpf/sl/winforms? What OS?
And what kind of series? Need more info.
Aliased lines must be snapped to device pixels, and there are some small variations if you look at the pixels on the different platforms.
Can you post a screen shot or some code that generates the plot (Ctrl+Alt+C)?