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

OxyPlot in Xamarin Studio

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

tyoung87 wrote at 2014-03-19 21:37:

How do I set up Xamarin Studio to use Oxyplot for Android? I've scoured the internet and tried multiple things myself and I can't figure it out. A simple, step by step walkthrough would be wonderful. Thanks ahead of time.

objo wrote at 2014-03-19 22:44:

I am currently preparing a Xamarin component for both iOS and Android. This should include some simple instructions how to get started. In the meantime you can look at the OxyPlot.XamarinAndroid solution.

tyoung87 wrote at 2014-03-20 18:01:

So doing further research into this, I've found some info that other people in my situation should know. If you try to open the OxyPlot.XamarinAndroid solution in Xamarin Studio, you will receive the following errors:

Could not load project 'OxyPlot\OxyPlot.csproj' with unknown item type '{786C830F-07A1-408B-BD7F-6EE04809D6DB}'
Could not load project 'Examples\ExampleLibrary\ExampleLibrary.csproj' with unknown item type '{786C830F-07A1-408B-BD7F-6EE04809D6DB}'

if you google 786C830F-07A1-408B-BD7F-6EE04809D6DB, you will find these pages:

http://stackoverflow.com/questions/10802198/visual-studio-project-type-guids
http://stackoverflow.com/questions/14515007/vs-2010-sp1-the-project-type-is-not-supported-by-this-installation

Which lets you know that this is an issue with Portable Class Libraries, and specifically deals with not having the Portable Library Tools installed. Now according to this page, it's possible to use Portable Library Tools in Xamarin Studio:

http://forums.xamarin.com/discussion/12105/pcl-in-xamarin-studio

But according to this page, the only way to install Portable Library Tools is to first have Visual Studio 2010 SP1 Pro or later installed:

http://msdn.microsoft.com/en-us/library/vstudio/gg597391(v=vs.100).aspx

So, plain and simple, the only way to use Oxyplot for Android or iOS before the component is officially released is if you have a copy of Visual Studio 2010 SP1 Pro or later installed so that you can build the project (or get someone else that does have it to build it for you). Past that, you're out of luck.

tyoung87 wrote at 2014-03-20 18:58:

Little more info. It actually is possible (I think). Portable Library Tools can be installed on a computer without Visual Studio on it if you run the installer from the command line and add the /buildmachine switch. See here for documentation:

http://msdn.microsoft.com/en-us/library/vstudio/gg597391(v=vs.100).aspx

tyoung87 wrote at 2014-03-20 21:11:

So I think that I've just about got this all figured out. So with just the Portable Library Tools, you'll run into issues about not having .net portable v4.0 profile 136. To get around this issue as well as the others, here's what you need to do:
  1. Download Portable Library Tools 2 from here: http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9-e138-410b-ad10-00cb3caf4981/
  2. Use the command line to run: PortableLibraryTools.exe /buildmachine
  3. Download the Microsoft .NET Portable Library Reference Assemblies 4.6 from here: http://www.microsoft.com/en-us/download/details.aspx?id=40727
  4. Run the exe file.
  5. Running the exe file will put the file PortableReferenceAssemblies.zip here: C:\Program Files (x86)\Microsoft .NET Portable Library Reference Assemblies 4.6
  6. Extract the zip file to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable (this is where you get profile 136)
  7. Install Xamarin Studio and Xamarin.Android
  8. Download and install StyleCop from here: https://stylecop.codeplex.com/releases/view/79972
  9. Download the Oxyplot source code and open the solution in Xamarin Studio and build it.
At this point everything should be building without error.

objo wrote at 2014-03-25 21:03:

Thanks for the detailed explanation! I was not aware that this was a problem. I will add this to the build notes.
Note: On Mac you only need Xamarin Studio, no need to install any extra components :-)
I hope we can get the Xamarin components up and running soon.

LinearAxis - Unit Rounding

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

user421 wrote at 2014-03-12 11:09:

Original post:
https://oxyplot.codeplex.com/workitem/10156

How do I round unit on axis?
Example:

I have set.
Axis.FormatAsFractions = true;
Axis.FractionUnit = Math.PI;
Axis.FractionUnitSymbol = "π";

I do not 1,2755645656231456π but something like 1,276π.

Thanks for the answer

Setting StringFormat only works when Axis.FormatAsFractions is set to false.

objo wrote at 2014-03-12 12:51:

This should now be fixed. A unit test that covers this case was also added.

Tooltip only for provided data points

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

balajiembed wrote at 2014-04-05 19:48:

Hi,

First of all, great Charting component. Just started using it.....

The question from me is, I would like to have a tool tip in a 2D line graph with only provided data points from me. As of now, it displays even the data points I havent provided and solves itself for the intermediate points. Is it possible someway to display the last or nearest "provided" data point in the tool tip?

Thanks in advance

Best,
Bala

Question about OxyPlot

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

ksmurphy141 wrote at 2013-11-20 16:03:

I need to create some line charts using Visual Studio 2008's C#. The charts will be populated dynamically using data from my database and displayed in a browser window. Can OxyPlot do this?

objo wrote at 2013-11-20 20:56:

I think VS 2010 is required for the Silverlight 4 solution. There is a WPF/NET 3.5 solution that should be possible to build in VS2008 but that means you need to output the plots to svg/pdf/png to show them in a browser window.

Heatmap aspect ratio

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

asalx wrote at 2013-11-06 14:28:

I would like to fix the aspect ratio of a heat map based on the x- and y-axis spans, so that one unit of both axes is drawn the same length on the screen.

This is the same behaviour as the "axis equal" command in matlab.

So, if x-axis is [0, 1] and y-axis is [0, 2], the height of the plot would be twice the width.

I didn't find information on this topic in the examples. How could I handle this problem?

Thanks.

objo wrote at 2013-11-06 22:53:

I think this should be covered by setting PlotType = PlotType.Cartesian on the PlotModel.
But I would like to refactor this as described in https://oxyplot.codeplex.com/workitem/10095

asalx wrote at 2013-11-07 08:55:

Thank you. I did notice the PlotType.Cartesian examples in the example browser but I did not understand what it was actually doing.

It works for setting the X- And Y-axes to the same scale. However, I am working with a heatmap which has a ColorAxis, and this axis should not have the same scale as the other two.

I see how the refactoring you propose would be able to handle this. (This proposal seems more flexible, BTW.)

But, in the current implementation, is there a possibility to explicitly exclude the ColorAxis from the Cartesian type? (The default ColorAxis graduation is just fine.)

Thanks.

objo wrote at 2013-11-07 22:28:

I submitted a fix!

asalx wrote at 2013-11-08 16:31:

Thanks, works great!

New IColorAxis implementation - StopColorAxis

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

stephenroe wrote at 2014-02-24 20:52:

I had a requirement for a different type of IColorAxis implementation that didn't currently exist.

The new IColorAxis implementation, named StopColorAxis, allows you to create a colour scale with specific colors at specific values (stops). Colours for values not at specific stops are interpolated from the nearest stops (upper and lower).

For example, suppose you have a StopColorAxis with a stop of Red (RGB[255, 0, 0]) at 0 and a stop of Green (RGB[0, 255, 0]) at 1. The colour returned for 0.5 would be halfway between red and green i.e. RGB[127, 127, 0]

This style of colour axis does not have a specific palette. Therefore the current IColorAxis interface methods (OxyColor GetColor(int paletteIndex) and int GetPaletteIndex(double value)) proved problematic. However, nearly all of the code base utilised the extension method OxyColor GetColor(double value) which has a signature more suited to my needs.

Therefore I modified IColorAxis to have a single method OxyColor GetColor(double value) and migrated all of the current implementations (leaving the extension method redundant).

The only issue I encountered was in ScatterSeries that utilised the original two methods of IColorAxis. In this case it was utilising the paletteIndex int as a key in a couple of dictionaries. As OxyColor is implemented as a struct and not a class it was trivial to change ScatterSeries to utilise the OxyColor as the key.

My question, is this the correct direction? You can view the modifications at my CodePlex fork on the StopColorAxis branch.

If this is the correct direction then I will add the appropriate examples and documentation before issuing a pull request.

Otherwise any suggestions to allow integration of an IColorAxis of this style would be appreciated.

objo wrote at 2014-02-25 11:17:

This sounds like a nice improvement! Could LinearGradientColorAxis be a better name? (cf. http://msdn.microsoft.com/en-us/library/system.windows.media.lineargradientbrush(v=vs.110).aspx)

I think the ScatterSeries try to improve performance by drawing all items with equal color together, but it could be a good idea to change this to a dictionary. Please test that performance is not significantly reduced. Then a change of IColorAxis as you suggest should be ok. I will have a look at the fork soon!

stephenroe wrote at 2014-02-25 23:26:

LinearGradientColorAxis sounds okay to me.

I'll take a look at how the Render method in ScatterSeries operates more closely and perform some testing/profiling. I have a feeling that the current implementation is optimised for a reasonable sized palette. The proposed LinearGradientColorAxis essentially has an unlimited palette size (actually 32-bit assuming ARGB) which is less likely to get multiple points with the same colour.

objo wrote at 2014-02-27 20:38:

Good! Can you also add an issue on this before making the pull request. I would like all pull requests to be connected to an issue from now on.
I think the issue description should explain the difference between the current LinearColorAxis and the LinearGradientColorAxis.

Click the LineSeries' title and get the response?

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

aoi wrote at 2013-07-23 11:14:

Dears,
I draw three lines on a graph, and I want to handle one of them by clicking its title, such as clearing the line?
how can i accomplish this?
thanks.!

New Gestures Feature

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

ishlasko wrote at 2014-04-28 18:37:

Just updated our system to the latest version, and the new gesture framework is great! Much better than the hack I was using before :)

Now that this is in place, it was trivially easy to let the user toggle between different manipulation modes without needing the keyboard.

Also set up something like the commonly-used DelegateCommand, to bind a delegate instead of a standard plot command:
Controller.BindKeyDown(OxyKey.Left, new OxyDelegateCommand<OxyKeyEventArgs>(a=>MoveTrackedItem(-1)));
Controller.BindKeyDown(OxyKey.Right, new OxyDelegateCommand<OxyKeyEventArgs>(a => MoveTrackedItem(+1)));
(Keeps the tracker visible, and moves it to the previous/next point in the current series)

No bug report here... Just paying my compliments to objo and Garreye. Looking great, guys.

objo wrote at 2014-04-29 09:07:

Thanks for the feedback, it is great to hear that this refactorization was helpful!

iOS CoreText Plot Title Off Center

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

benhysell wrote at 2014-04-05 16:40:

See details in issue https://oxyplot.codeplex.com/workitem/10163

Any ideas on things to go after, things I can attempt to debug, things to try to shed some more light on this issue? I'm super motivated to put this one to bed, it is the last thing holding me up before pushing a release to the App Store.

Thanks!

Configuring DateTimeAxis question

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

DShawNitec wrote at 2012-06-27 18:12:

I have been using the DateTimeAxis for some dynamically created plots. But I have yet to figure out what combination of options I need to get an axis the way the users want.

I'm using the following now:

hAxisDate.Minimum = OxyPlot.DateTimeAxis.ToDouble(minDate);
hAxisDate.Maximum = OxyPlot.DateTimeAxis.ToDouble(maxDate);
hAxisDate.IntervalType = DateTimeIntervalType.Years;
hAxisDate.MajorTickSize = 10;
hAxisDate.MinorIntervalType = DateTimeIntervalType.Months;
hAxisDate.ShowMinorTicks = true;
hAxisDate.MinorStep = 1;
hAxisDate.MinorTickSize = 5;
With minDate of 6/22/2013 and maxDate of 1/1/2017 I only get MajorTicks and Dates.
the dates are 2015,2017,2019,2021,2023,2025,2027 no MajorTick's in between or dates. 
Also no month ticks.
Users would like to see major ticks at each year, date every other or whatever would show without overlap.
Along with month ticks if they would not get to crowded.

objo wrote at 2012-06-28 06:48:

(use HTML edit mode to get rid of too many <pre> tags in the posts)

I think the DateTimeAxis implementation needs some refactoring, but I have not figured out how to solve this yet. It should be possible to use the 'automatic' mode and get 'nice' tick values. It should also be possible to zoom in/out and see it change from years, to dates and finally to time, automatically...

The issue is already in the issue tracker http://oxyplot.codeplex.com/workitem/7988, 6 votes so far!

The actual source code for this issue is in DateTimeAxis.CalculateActualInterval. this is the best place to look to figure out how to current code works...