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

Additional ticks in DateTimeAxis

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

ffiala wrote at 2012-02-23 12:40:

During my first experiments with OxyPlot I found the following detail:

When using a scale of one or ten years the scale is error free.
Example: http://oxyplot.iam.at/examplesvg.aspx?title=DateTimeAxisFiala.DateTime+axis1+Fiala

But when using a scale of 100 years additional and smaller ticks can be seen on the time axis at 1930, 1960 and 1990).
Example: http://oxyplot.iam.at/examplesvg.aspx?title=DateTimeAxisFiala.DateTime+axis2+Fiala
Code: http://oxyplot.iam.at/examplecode.aspx?title=DateTimeAxisFiala.DateTime+axis2+Fiala

Am I missing a setting?
Thank You, Franz 


objo wrote at 2012-02-23 22:16:

Thanks for attaching the example, getting the code makes it much easier to reproduce the bugs!

Sorry, the DateTimeAxis is not completed yet - I see it does not work properly with long (100 years) time ranges.

I tried setting the IntervalType = DateTimeIntervalType.Years (which should force the axis to show years only). I also think that part of the problem is that MajorStep/MinorStep (in days) cannot handle leap years properly. A solution could be to give Minimum/Maximum/MajorStep/MinorStep in years when the Interval type is Years.

Workaround: Can you use a LinearAxis with years as numbers instead?

Can I include your example as a test we can use to get the "long-term" DateTimeAxis working?


ffiala wrote at 2012-02-24 16:07:

Thanks for the advice to use LinearAxes instead of DateTimeAxes. This version now works perfectly.

Example: http://oxyplot.iam.at/examplesvg.aspx?title=DateTimeAxisFiala.DateTime+axis3+Fiala
Code: http://oxyplot.iam.at/examplecode.aspx?title=DateTimeAxisFiala.DateTime+axis3+Fiala

In this example the given dates are yyyy-01-01 so the numbers forming the data series appear as integer values. I am using a conversion function to convert each DateTime value down to milliseconds into an double value considering the leapyears. May be You can use the conversion function to get a certain datetime number:

        static double DateToNumber(DateTime date)
        {
            int[] DaysToMonth = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
            int Year = date.Year;
            bool IsLeapYear = ((Year % 4 == 0) && (Year % 100 != 0)) || (Year % 400 == 0);
            int LeapDay = IsLeapYear && (date.Month > 2) ? 1 : 0;
            long SecondsPerYear = (365+LeapDay) * 24 * 60 * 60;
            double TimeInYears = Year + (date.Millisecond*1.0/1000 + date.Second + date.Minute * 60 + date.Hour * 3600 + (date.Day-1 + LeapDay + DaysToMonth[date.Month-1]) * 3600 * 24)/SecondsPerYear;
            return TimeInYears;
        }

It works exactly up to yyyy-12-31 24:59:59.999

Some of my DateTime experiments:

Example1:http://austr.iam.at/?cmd=cat&arg=153
Example2:http://austr.iam.at/?cmd=cat&arg=86 

(You can use all of these functions.)

Disabling Line Tracker (coordinate display)

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

ryoujr wrote at 2013-07-23 23:06:

Hello,

Is there any newly implemented feature to disable line tracker for each line series? I have 3 line series and I'd like to display tracker only on one line.
Actually, I could find some information posted last year and at that time there was no that kind of option or API, but I would like to know if it is possible now.

Thank you in advance and Regards,
Ian.

raphay wrote at 2013-07-24 13:29:

I believe it's not implemented yet, but we talked about a solution to this problem, in this topic : https://oxyplot.codeplex.com/discussions/449252

I hope this will help you.
0
Under review

CategoryAxis: How to programmatically pan with ColumnSeries question

vac 8 years ago updated by Oystein Bjorke 8 years ago 1

I have a PlotView (I'm using Xamarin.Forms) and show a ColumnSeries by using a LinearAxis on the left and a CategoryAxis on the bottom.


The ColumnSeries is displayed correctly. Is there a way to pan the column bars to the left programmatically via code behind (c#)?


Currently I have a fixed number of bars (12). When new data comes in I remove the index 0 from the columnSeries items and add the new one to the end of the list. If I Invalidate the plotView it looks like the bars got slided to the left with one new value added. But this looks very rough because the bars get shifted by 1 bar width.


I want to pan the bars to the left before I add the new value to get a smooth shifting look. Is there a way to do this by panning the
categoryAxis somehow in code behind?


Thanks! :-)

Importing SVG

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

etrgyphon wrote at 2014-01-03 16:21:

I have an SVG that was created by OxyPlot. I can't find a import function. I just need to show the SVG image and not manipulate it.

Is that outside the scope of this project?

objo wrote at 2014-01-07 22:03:

Yes, Oxyplot only exports SVG. It would be nice to be able to import SVG, but that's a big task and is not planned.
I want to implement a drawing model that should make it possible to include drawings in plots, but this should be very simple (not including svg import).

I would use an external library:
https://github.com/vvvv/SVG
https://sharpvectors.codeplex.com/

PointTracker for Winform (simple implementation)

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

heromyth wrote at 2012-05-09 04:29:

It's using a TextLabel to implement the tracker. It's just better than nothing.

diff -r 93124cd413d6 Source/OxyPlot.WindowsForms/Plot.cs
--- a/Source/OxyPlot.WindowsForms/Plot.cs    Thu Apr 26 21:11:20 2012 +0200
+++ b/Source/OxyPlot.WindowsForms/Plot.cs    Wed May 09 10:21:11 2012 +0800
@@ -223,6 +223,7 @@
         /// </summary>
         public void HideTracker()
         {
+            m_label.Visible = false;
         }
 
         /// <summary>
@@ -381,8 +382,20 @@
         /// </param>
         public void ShowTracker(TrackerHitResult data)
         {
-            // not implemented for WindowsForms
+            if (m_label == null)
+            {
+                m_label = new Label();
+                m_label.Parent = this;
+                m_label.BackColor = Color.LightSkyBlue;
+                m_label.AutoSize = true;
+            }
+
+            m_label.Text = data.ToString();
+            m_label.Top = (int)data.Position.Y - this.Top;
+            m_label.Left = (int)data.Position.X - this.Left;
+            m_label.Visible = true;
         }
+        private Label m_label;
 
         /// <summary>
         /// The show zoom rectangle.


objo wrote at 2012-05-11 00:17:

thanks for the code, I will add this soon! I agree that a Label is better than nothing :)


objo wrote at 2014-02-02 20:57:

Sorry I forgot about this one... I have included the simple tracker, and created a work issue to improve it: https://oxyplot.codeplex.com/workitem/10125

make "virtual internal" to "virtual internal protected" to PreTransform and PostInverseTransform Axis baseclass

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

chage wrote at 2014-03-26 19:27:

Hi Objo,
Good day. One question/request...
is there a reason not having PreTransform and PostInverseTransform declared as protected since it is marked as virtual for overriddes.

I have derived a custom axis class that requires PreTransform and PostInverseTransorm to be overridden (a norm std distribution z-index axis). I had it in OxyPlot assembly previously which is fine when they were internal only. I found that it creates alot of work when i merge with your code from time to time.

So decided to move the custom axis class out of the assembly, but hit into limitation of these method not being protected.

if possible, please mark those protected so it doesnt defeat the purpose of having the derived class overrides them.

thanks again for the cool library.

objo wrote at 2014-03-26 20:07:

I was hoping we could get rid of these methods, but I have not found a good way to do this yet. It seems to be convenient to use these methods in the CalculateActualMaximum, CalculateActualMinimum and UpdateTransform methods in the Axis class. So I agree with you, let use change to protected to allow overriding in custom axes!
ps: it is very cool to hear of such advanced use of the library!

chage wrote at 2014-03-26 21:05:

Thanks objo! Saw the code changes got checked in. that was fast!
0
Under review

MouseClick point label cut off

oxyplotter 9 years ago updated 9 years ago 2

I'm working on some simple column charts and line series graphs. I really like that the feature for clicking on a bar/ point automatically shows the values. However, in my current charts, when you click on the last column to the right for example, the text of the point label is cut off. Is there a way to get this to flip (show to the left of the mouse) when you get too close to the margins of a plot or form? I've seen functionality similar to what I'm looking for in the Example Browser but this part doesn't seem to be shown in the code. Thanks in advance for any help!

Change the color of markers in line series in WPF?

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

oriches wrote at 2014-05-08 17:33:

Is it possible to change the color of individual markers in a line series in WPF?

objo wrote at 2014-05-08 18:36:

No, all markers have the same color for a LineSeries. But it should be possible to use a ScatterSeries to draw the markers with different colors!

oriches wrote at 2014-05-08 18:57:

sorry, but how?

oriches wrote at 2014-05-08 19:30:

I've worked it out, because the number of markers I want are few (less than 10 out of 2000) I can do this by having multiple scatter series.

objo wrote at 2014-05-10 23:19:

There is a property ScatterPoint.Value that can be used to define the color of the points in a ScatterSeries. Also remember to set the ScatterSeries.ColorAxis.

Version 2013.2.106.1 Marker problems

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

CatalinMurariu wrote at 2013-10-25 11:06:

Hi,

After updating to last version the markers don't get drawn on the line series anymore, although they do get drawn on the legend. Any hotfix for this?

objo wrote at 2013-10-25 22:35:

Thanks for the bug notice! It should be corrected now. (I think this happened when I changed the OxyColor type to a value type)

CatalinMurariu wrote at 2013-10-28 15:19:

Thank you for the quick fix!

MatrixSeries custom color for each value

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

everytimer wrote at 2013-07-22 22:48:

I need to modify the MatrixSeries class for being able to select a color for each value, or at least for each cell. Does anyone know how to do that? Thanks

everytimer wrote at 2013-07-22 22:59:

Ok, OxyPlot is pretty awesome once again. It was pretty simple, you just need to change one line of code:
          if (this.image == null)
            {
                var pixels = new OxyColor[m, n];
                for (int i = 0; i < m; i++)
                {
                    for (int j = 0; j < n; j++)
                    {
                        var c = OxyColor.FromHsv(Matrix[i,j], 0.8, 0.8);

                        //pixels[i, j] = Math.Abs(this.Matrix[m - 1 - i, j]) <= this.ZeroTolerance ? OxyColors.Transparent : this.NotZeroColor;
                        pixels[i, j] = Math.Abs(this.Matrix[m - 1 - i, j]) <= this.ZeroTolerance ? OxyColors.Transparent : c;
                 
                    }
                }

                this.image = OxyImage.PngFromArgb(pixels);
            }