Code Monkey home page Code Monkey logo

microsoft / interactivedatadisplay.wpf Goto Github PK

View Code? Open in Web Editor NEW
959.0 65.0 263.0 2.75 MB

Interactive Data Display for WPF is a set of controls for adding interactive visualization of dynamic data to your application. It allows to create line graphs, bubble charts, heat maps and other complex 2D plots which are very common in scientific software. Interactive Data Display for WPF integrates well with Bing Maps control to show data on a geographic map in latitude/longitude coordinates. The controls can also be operated programmatically.

License: Other

C# 100.00%

interactivedatadisplay.wpf's Introduction

Interactive Data Display for WPF

Interactive Data Display for WPF is a set of controls for adding interactive visualization of dynamic data to your application. It allows to create line graphs, bubble charts, heat maps and other complex 2D plots which are very common in scientific software. Interactive Data Display for WPF integrates well with Bing Maps control to show data on a geographic map in latitude/longitude coordinates. The controls can also be operated programmatically.

How to install

The IDD for WPF can be installed from NuGet:

PM > Install-Package InteractiveDataDisplay.WPF -Version 1.0.0

How to use

Drawing with Interactive Data Display is easy.

One line of C# code to draw simple linegraph:

linegraph.Plot(x,y); // x and y are IEnumerable<double>

And corresponding XAML snippet:

<d3:Chart BottomTitle="Argument" LeftTitle="Function">
     <d3:LineGraph x:Name="linegraph" Description="Simple linegraph" Stroke="Blue" StrokeThickness="3"/>
</d3:Chart> 

If we get arrays x and y as:

var x = Enumerable.Range(0, 1001).Select(i => i / 10.0).ToArray();
var y = x.Select(v => Math.Abs(v) < 1e-10 ? 1 : Math.Sin(v) / v).ToArray();

We will receive:

Other Interactive Data Display samples:

See the source code here.

Licensing

Interactive Data Display for WPF is under the MIT license.

Other

There is also Interactive Data Display for Javascript. You can see interactive samples here.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

interactivedatadisplay.wpf's People

Contributors

alexx999 avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar msftgits avatar nikitaskoblov avatar skoster-enclustra avatar tagsemb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

interactivedatadisplay.wpf's Issues

BingMapsPlot - GetParentMap

In the sample the xaml is setup as such:

<m:Map Mode="Road" Name="bingmap"> <d3:BingMapsPlot Name="plot"> <d3:CircleMarkerGraph Name="markers" ColorDescription="Crop density" Size="6" YDataTransform="{Binding YDataTransform, ElementName=plot}" ClipToBounds="False" /> </d3:BingMapsPlot> </m:Map>

However I couldn’t get the plot to look right on the map and the GetParentMap function returned null until I added:

<m:Map Mode="Road" Name="bingmap"> <d3:BingMapsPlot Name="plot" Tag="{Binding ElementName=bingmap}" > <d3:CircleMarkerGraph Name="markers" ColorDescription="Crop density" Size="6" YDataTransform="{Binding YDataTransform, ElementName=plot}" ClipToBounds="False" /> </d3:BingMapsPlot> </m:Map>

Descending vertical axis

Right now it is impossible to create vertical axis with descending values. E.g.

  • 1
  • 2
  • 3

If I assign range(500,200) I got ascending axis (200,500).
There is also no corresponding property to specify whether the axis ascends or descends.

Documentation

Hi!
Is there any documentation for InteractiveDataDisplay.WPF ?

thanks

Nuget package

Nuget package would significantly simplify the use of IDD.WPF.
Also I'm missing how-to-start and how-to-build sections in README.md.

Request a New Release Version

I noticed latest version is 1.0.0 in 2017, but still have new code in 2018. So we missed some code in 1.0.0. Anyone can use latest code to create a new release version?

bug:mouse wheel to zoom out in HeatmapSample

I just found a bug. when zooming out in heatmatpsample.
`
private void OnTaskCompleted(RenderResult r, RenderTaskState state)
{
if (r != null && !state.IsCanceled)
{

            WriteableBitmap wr = new WriteableBitmap((int)r.Output.Width, (int)r.Output.Height, 96, 96, PixelFormats.Bgra32, null);// **bug here when zoom out**
            // Calculate the number of bytes per pixel. 
            int bytesPerPixel = (wr.Format.BitsPerPixel + 7) / 8;
            // Stride is bytes per pixel times the number of pixels.
            // Stride is the byte width of a single rectangle row.
            int stride = wr.PixelWidth * bytesPerPixel;
            wr.WritePixels(new Int32Rect(0, 0, wr.PixelWidth, wr.PixelHeight), r.Image, stride, 0);


            outputImage.Source = wr;
            Canvas.SetLeft(outputImage, r.Output.Left);
            Canvas.SetTop(outputImage, r.Output.Top);
            imageCartesianRect = r.Visible;
            imageSize = new Size(r.Output.Width, r.Output.Height);
            outputImage.RenderTransform = null;
        }

        RaiseTaskCompletion(state.Id);

        runningTasks.Remove(state);

        while (tasks.Count > 1)
        {
            long id = tasks.Dequeue();
            RaiseTaskCompletion(id);
        }
        if (tasks.Count > 0 && runningTasks.Count < maxTasks)
        {
            EnqueueTask(tasks.Dequeue());
        }

        InvalidateMeasure();
    }

`
捕获

if should be chang to following

` if (r != null && !state.IsCanceled)
{
int width = (int)r.Output.Width;
int heitht = (int)r.Output.Height;
if (width!=0&& heitht!=0)
{
WriteableBitmap wr = new WriteableBitmap(width, heitht, 96, 96, PixelFormats.Bgra32, null);
// Calculate the number of bytes per pixel.
int bytesPerPixel = (wr.Format.BitsPerPixel + 7) / 8;
// Stride is bytes per pixel times the number of pixels.
// Stride is the byte width of a single rectangle row.
int stride = wr.PixelWidth * bytesPerPixel;
wr.WritePixels(new Int32Rect(0, 0, wr.PixelWidth, wr.PixelHeight), r.Image, stride, 0);

            outputImage.Source = wr;
            Canvas.SetLeft(outputImage, r.Output.Left);
            Canvas.SetTop(outputImage, r.Output.Top);
            imageCartesianRect = r.Visible;
            imageSize = new Size(r.Output.Width, r.Output.Height);
            outputImage.RenderTransform = null;
            }
        }

`

Hiding the description of a LineGraph / Binding multiple graph plots to one description

Hello,
I'm making an application where i need to have two graph's that are drawed disontinuously so every graph is situated in a gap of one another. I wasn't able to find any other solution then creating for each chunk a new LineGraph and plotting them all together but now i have like a 15 descriptions in a legend for one graph. Can i hide some of those decription or better can i somehow bind them together while still remaining discontinuous to have only one description for them all? Thank you

Graph got stuck when moving mouse over

Hi contributors, I took HeatmapSample example as a starting point to make an oscilloscope-like animation, but actually what I drew is a LineGraph. A problem's been blocking me for a while, that is, everytime you move your mouse over the graph or drag it or zoom in/out, the graph would go slower. And if I move mouse really quickly, the graph would even go totally frozen.

Any ideas?

Interactive Data display in KeyboardNavigation

I read the source code KeyboardNavigation.cs in InteractiveDataDisplay.WPF . i just don't no why need

IsZoomEnable(rect)

to check before setting the zooming.

private void DoZoom(double factor) { if (masterPlot != null) { var rect = masterPlot.PlotRect;

        if (IsHorizontalNavigationEnabled)
            rect.X = rect.X.Zoom(factor);
        if (IsVerticalNavigationEnabled)
            rect.Y = rect.Y.Zoom(factor);


        if (IsZoomEnable(rect))// why need this check?
        {
            masterPlot.SetPlotRect(rect);
            masterPlot.IsAutoFitEnabled = false;
        }
    }
}

private bool IsZoomEnable(DataRect rect)
{
    bool res = true;
    if (IsHorizontalNavigationEnabled)
    {
        double e_max = Math.Log(Math.Max(Math.Abs(rect.XMax), Math.Abs(rect.XMin)), 2);
        double log = Math.Log(rect.Width, 2);
        res = log > e_max - 40;
    }
    if (IsVerticalNavigationEnabled)
    {
        double e_max = Math.Log(Math.Max(Math.Abs(rect.YMax), Math.Abs(rect.YMin)), 2);
        double log = Math.Log(rect.Height, 2);
        res = res && log > e_max - 40;
    }
    return res;
}

Why the Chart is sealed?

HI
I'm glad to find this package. it' very useful.
but I found that the package is different to the old version of dynamicdatedisplay. and I have some little issues to ask.

1 Is The package NOT a CLSCompliant .
2 The class Chart Sealed so can not derived from it, why?.
3 The legend is overlay the main curve region, can it settle at right side like a nomal chart..

Thanks

Binding

Will binding work on linegraph. I tried binding the property "Points" of the type "LineGraph" to an observablecollection<System.Windows.Point> which didn't work.

Binding errors

Using even empty chart (or anything from examples)

<d3:Chart>
     <d3:LineGraph x:Name="linegraph" Description="Simple linegraph"/>
</d3:Chart>

Will display plenty of binding errors after running the program:

obraz

Charts themselves work fine, but its hard to debug with so many errors around, hard to tell which one are real.

P.S

I have posted this issue before today, but I lost access to my email, so couldn't log in any more (amazing forced 2 step authentication), and for some reason this issue is gone, so I'm posting this again.

DateTime axis

I believe that with DynamicDataDisplay it used to be possible to have a DateTime axis. Can't find this capability anywhere in this new version, what happened to it?

DependentPlotter vertical axis range set to fixed value

How could i set vertical axis range to fixed value?
Used dynamic data display

code is give below:
<d3:ChartPlotter Name="ValvePlotter" Width="auto" Height="auto" MinWidth="500" MinHeight="300" LegendVisible="False" MainHorizontalAxisVisibility="Collapsed" MainVerticalAxisVisibility="Collapsed" >
<d3:DependentPlotter x:Name="InletPlotter" >
<d3:VerticalAxis Placement="Left" Foreground="Red"/>
<d3:VerticalAxisTitle Content="{DynamicResource InletP0Header}" Placement="Left" Foreground="Red"></d3:VerticalAxisTitle>
<d3:LineGraph DataSource="{Binding FineTuneInletData}" Stroke="Red" d3:Legend.Description="Inlet" ></d3:LineGraph>
</d3:DependentPlotter>
<d3:DependentPlotter x:Name="OutletPlotter">
<d3:VerticalAxis Placement="Right" Foreground="Blue"/>
<d3:HorizontalAxis Placement="Bottom" Foreground="Black"/>
<d3:VerticalAxisTitle Content="{DynamicResource OutletP1Header}" Placement="Right" Foreground="Blue"></d3:VerticalAxisTitle>
<d3:HorizontalAxisTitle Content="{DynamicResource TimeAxisHeader}" Placement="Bottom" Foreground="Black"></d3:HorizontalAxisTitle>
<d3:LineGraph DataSource="{Binding FineTuneOutletData}" Stroke="Blue" d3:Legend.Description="Outlet"></d3:LineGraph>
</d3:DependentPlotter >
</d3:ChartPlotter>

HeatMap crashes when zooming out a lot.

When zooming out of the heatmap up until it's not visible the library throws an

System.ArgumentException: 'Value does not fall within the expected range.'
InnerException:
ArgumentException: Value does not fall within the expected range.

Class -> BackgroundBitmapRenderer
Method -> OnTaskCompleted(RenderResult r, RenderTaskState state)

line of code that causes the crash
WriteableBitmap wr = new WriteableBitmap((int)r.Output.Width, (int)r.Output.Height, 96, 96, PixelFormats.Bgra32, null);

If you could adjust that method by adding an extra if statement that would be great. Then I can just update library through nuget

Solution
** Class BackgroundBitmapRenderer**

private void OnTaskCompleted(RenderResult r, RenderTaskState state)
        {
            if (r != null && !state.IsCanceled)
            {
                if ((int)r.Output.Width >= 1 || (int)r.Output.Height >= 1) {  //-----------This if statement can fix it--------------------
                    WriteableBitmap wr = new WriteableBitmap((int)r.Output.Width, (int)r.Output.Height, 96, 96, PixelFormats.Bgra32, null);
                    // Calculate the number of bytes per pixel. 
                    int bytesPerPixel = (wr.Format.BitsPerPixel + 7) / 8;
                    // Stride is bytes per pixel times the number of pixels.
                    // Stride is the byte width of a single rectangle row.
                    int stride = wr.PixelWidth * bytesPerPixel;
                    wr.WritePixels(new Int32Rect(0, 0, wr.PixelWidth, wr.PixelHeight), r.Image, stride, 0);


                    outputImage.Source = wr;
                    Canvas.SetLeft(outputImage, r.Output.Left);
                    Canvas.SetTop(outputImage, r.Output.Top);
                    imageCartesianRect = r.Visible;
                    imageSize = new Size(r.Output.Width, r.Output.Height);
                    outputImage.RenderTransform = null;
                }             
            }
            RaiseTaskCompletion(state.Id);

            runningTasks.Remove(state);

            while (tasks.Count > 1)
            {
                long id = tasks.Dequeue();
                RaiseTaskCompletion(id);
            }
            if (tasks.Count > 0 && runningTasks.Count < maxTasks)
            {
                EnqueueTask(tasks.Dequeue());
            }

            InvalidateMeasure();
        }

how to add scrollview to linegraph

i want to add linegraph with scrollviewer, so user can scroll to the wanted position quickly。

        <d3:Figure x:Name="xy">
            <Axis x:Name="x"  AxisOrientation="Left"  d3:Figure.Placement="Left"/>
            <Axis x:Name="y" AxisOrientation="Bottom" d3:Figure.Placement="Bottom"/>
            <d3:AxisGrid x:Name="PART_axisGrid"
                             VerticalTicks="{Binding Ticks,ElementName=x, Mode=OneWay}"
                             HorizontalTicks="{Binding Ticks,ElementName=y, Mode=OneWay}"/>
            <d3:Plot>
                <d3:LineGraph x:Name="myLineGraph"/>
            </d3:Plot>
        </d3:Figure>

image

BingMapsPlot data points offset when changing window size

I'm having an issue where if I change the size of my window, the circles of my CircleMarkerGraph no longer appear on the same location of a Bing map, but are rather shifted over to the left/west. This can be reproduced by (1) running BingMapsSample, (2) maximizing the window, and (3) zooming in to various extents. I see this in my own code as well.

compatibility issue with IDD V1.0

I am new to WPF. I tried your guide for a first project using IDD and it did not work because of a recent change to a package called System.Reactive.
When you follow the guide it builds but you get a run time error in XAML.

Please see StephanBartels comment here,
louthy/echo-process#19
So perhaps the guide also needs to say, "then use NuGet to install System.Reactive.Compatibility V4.0"

How can I draw a Circle by using InteractiveDataDisplay?

I am new to programming ,so I have some troubles to draw a Circle by using InteractiveDataDisplay.WPF.
I will be very appreciate if someone could tell me some ways to draw a Circle by using InteractiveDataDisplay.WPF,thanks a lot !!!

Extremely high CPU usage and lots of GC runs

Hi!

I have three charts with linked PlotWidth and PlotOriginX properties so that when I pan/zoom, their displayed interval is the same.

I intend to display a lot of points, often several tens of thousands and when I pan/zoom a chart with this many points, IDD causes my CPU to run at 100%, and Visual Studio indicates that GC collect runs "constantly" (extremely frequently). I know I'm asking a lot from the library, but is there a way to solve this issue?

Contour Plot possible?

Is it possible to draw a contour plot? I found an example that uses

<d3:IsoLineGraph />

However, it is not available in the wpf package.

Is there any other possibility?

Installation issue

Please be noticed that it also has dependent on System.Reactive.Core and System.Reactive.Linq after installation.

.Net Core

I have a fork working on .net core here (everything except Bing maps seems to be working)). I was wondering if the maintainers of this project are interested in merging those changes or maybe reworking them so that the project works with .Net Framework and .Net Core?

Export graphic to Image

Hi folks,

This package is really amazing and helps me a lot. Thanks!

I'm trying to export a Line Graph to an Image, but the Series doesn't work properly. The graphic was plot properly but Series didn't.

I don't know if it is a bug or I'm doing something wrong.

This link has the code used and the results.

Thanks.

HeatMap Palette

The colour palette in the heatmap graph is not properly working, even in the given example.
Min and max values are reversed and the colours set in the xml file just mess everything up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.