Новый модуль PlotWPF на основе InteractiveDataDisplay.WPF.dll
This commit is contained in:
parent
d03b31a2da
commit
fea18f8109
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
||||||
public const string Major = "3";
|
public const string Major = "3";
|
||||||
public const string Minor = "8";
|
public const string Minor = "8";
|
||||||
public const string Build = "0";
|
public const string Build = "0";
|
||||||
public const string Revision = "2932";
|
public const string Revision = "2934";
|
||||||
|
|
||||||
public const string MainVersion = Major + "." + Minor;
|
public const string MainVersion = Major + "." + Minor;
|
||||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
%COREVERSION%=0
|
%COREVERSION%=0
|
||||||
%REVISION%=2932
|
%REVISION%=2934
|
||||||
%MINOR%=8
|
%MINOR%=8
|
||||||
%MAJOR%=3
|
%MAJOR%=3
|
||||||
|
|
|
||||||
288
InteractiveDataDisplay_OneDll/.gitignore
vendored
Normal file
288
InteractiveDataDisplay_OneDll/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,288 @@
|
||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
##
|
||||||
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
|
||||||
|
# Visual Studio 2015 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUNIT
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# .NET Core
|
||||||
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
**/Properties/launchSettings.json
|
||||||
|
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_i.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# JustCode is a .NET coding add-in
|
||||||
|
.JustCode
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# Visual Studio code coverage results
|
||||||
|
*.coverage
|
||||||
|
*.coveragexml
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/packages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/packages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/packages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
*.ndf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Typescript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
|
*.vbw
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# JetBrains Rider
|
||||||
|
.idea/
|
||||||
|
*.sln.iml
|
||||||
|
|
||||||
|
# CodeRush
|
||||||
|
.cr/
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Cake - Uncomment if you are using it
|
||||||
|
# tools/**
|
||||||
|
# !tools/packages.config
|
||||||
|
|
||||||
|
# Telerik's JustMock configuration file
|
||||||
|
*.jmconfig
|
||||||
|
|
||||||
|
# BizTalk build output
|
||||||
|
*.btp.cs
|
||||||
|
*.btm.cs
|
||||||
|
*.odx.cs
|
||||||
|
*.xsd.cs
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>InteractiveDataDisplay.WPF</id>
|
||||||
|
<version>1.1.0</version>
|
||||||
|
<title>InteractiveDataDipslay.WPF</title>
|
||||||
|
<authors>Sergey Berezin, Vassily Lyutsarev, Nikita Skoblov, Natalia Stepanova</authors>
|
||||||
|
<owners>Microsoft; MSU ITIS Lab</owners>
|
||||||
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
|
<licenseUrl>https://github.com/Microsoft/InteractiveDataDisplay.WPF/blob/master/LICENSE</licenseUrl>
|
||||||
|
<projectUrl>https://github.com/Microsoft/InteractiveDataDisplay.WPF</projectUrl>
|
||||||
|
<description>Interactive Data Display for WPF is a set of controls for adding interactive visualization of dynamic data to your application.</description>
|
||||||
|
<summary>Interactive Data Dipslay for WPF allows to create line graphs, bubble charts, heat maps and other complex 2D plots which are very common in scientific software. It integrates well with Bing Maps control to show data on a geographic map in latitude/longitude coordinates. The controls can also be operated programmatically.</summary>
|
||||||
|
<copyright>Copyright 2017 Microsoft Corporation</copyright>
|
||||||
|
<tags>idd wpf visualization plot plots plotting chart charting data interactive datavisualization</tags>
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework=".NETFramework4.5.2">
|
||||||
|
<dependency id="Microsoft.Maps.MapControl.WPF" version="1.0.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="System.Reactive" version="[3.1.1,4.0.0)" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
<group targetFramework=".NETFramework4.6">
|
||||||
|
<dependency id="Microsoft.Maps.MapControl.WPF" version="1.0.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="System.Reactive" version="4.0.0" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
<frameworkAssemblies>
|
||||||
|
<frameworkAssembly assemblyName="Microsoft.CSharp" targetFramework=".NETFramework4.5.2, .NETFramework4.6" />
|
||||||
|
<frameworkAssembly assemblyName="PresentationCore" targetFramework=".NETFramework4.5.2, .NETFramework4.6" />
|
||||||
|
<frameworkAssembly assemblyName="PresentationFramework" targetFramework=".NETFramework4.5.2, .NETFramework4.6" />
|
||||||
|
<frameworkAssembly assemblyName="System.Core" targetFramework=".NETFramework4.5.2, .NETFramework4.6" />
|
||||||
|
<frameworkAssembly assemblyName="System.Data.DataSetExtensions" targetFramework=".NETFramework4.5.2, .NETFramework4.6" />
|
||||||
|
<frameworkAssembly assemblyName="System.Data" targetFramework=".NETFramework4.5.2, .NETFramework4.6" />
|
||||||
|
<frameworkAssembly assemblyName="System" targetFramework=".NETFramework4.5.2, .NETFramework4.6" />
|
||||||
|
<frameworkAssembly assemblyName="System.Net.Http" targetFramework=".NETFramework4.5.2, .NETFramework4.6" />
|
||||||
|
<frameworkAssembly assemblyName="System.Xaml" targetFramework=".NETFramework4.5.2, .NETFramework4.6" />
|
||||||
|
<frameworkAssembly assemblyName="System.Xml" targetFramework=".NETFramework4.5.2, .NETFramework4.6" />
|
||||||
|
<frameworkAssembly assemblyName="System.Xml.Linq" targetFramework=".NETFramework4.5.2, .NETFramework4.6" />
|
||||||
|
</frameworkAssemblies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="src\bin\Release\**\InteractiveDataDisplay.WPF**" target="lib" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
23
InteractiveDataDisplay_OneDll/LICENSE
Normal file
23
InteractiveDataDisplay_OneDll/LICENSE
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
InteractiveDataDisplay.WPF
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE
|
||||||
68
InteractiveDataDisplay_OneDll/README.md
Normal file
68
InteractiveDataDisplay_OneDll/README.md
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
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](https://www.nuget.org/packages/InteractiveDataDisplay.WPF/):
|
||||||
|
```
|
||||||
|
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:
|
||||||
|
````c#
|
||||||
|
linegraph.Plot(x,y); // x and y are IEnumerable<double>
|
||||||
|
````
|
||||||
|
And corresponding XAML snippet:
|
||||||
|
````xaml
|
||||||
|
<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:
|
||||||
|
````c#
|
||||||
|
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:
|
||||||
|
|
||||||
|
<img src="/images/sinline.PNG" align="center" height="300" width="415" margin="auto">
|
||||||
|
|
||||||
|
Other Interactive Data Display samples:
|
||||||
|
|
||||||
|
<img src="/images/line.PNG" align="left" height="300" width="415" >
|
||||||
|
<img src="/images/markers.PNG" align="left" height="300" width="415" >
|
||||||
|
<img src="/images/heatmap.PNG" align="left" height="300" width="415" >
|
||||||
|
<img src="/images/barchart.PNG" align="left" height="300" width="415" >
|
||||||
|
<img src="/images/map.PNG" align="center" height="300" width="415" margin="auto">
|
||||||
|
|
||||||
|
See the source code [here](https://github.com/Microsoft/InteractiveDataDisplay.WPF/tree/master/samples).
|
||||||
|
|
||||||
|
Licensing
|
||||||
|
---------
|
||||||
|
|
||||||
|
Interactive Data Display for WPF is under the [MIT license](https://github.com/Microsoft/InteractiveDataDisplay.WPF/blob/master/LICENSE).
|
||||||
|
|
||||||
|
Other
|
||||||
|
-----
|
||||||
|
There is also [Interactive Data Display](https://github.com/predictionmachines/InteractiveDataDisplay) for Javascript. You can see interactive samples [here](http://predictionmachines.github.io/InteractiveDataDisplay).
|
||||||
|
|
||||||
|
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](https://opensource.microsoft.com/codeofconduct/).
|
||||||
|
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
||||||
|
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
||||||
BIN
InteractiveDataDisplay_OneDll/images/barchart.PNG
Normal file
BIN
InteractiveDataDisplay_OneDll/images/barchart.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
BIN
InteractiveDataDisplay_OneDll/images/heatmap.PNG
Normal file
BIN
InteractiveDataDisplay_OneDll/images/heatmap.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 496 KiB |
BIN
InteractiveDataDisplay_OneDll/images/line.PNG
Normal file
BIN
InteractiveDataDisplay_OneDll/images/line.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 210 KiB |
BIN
InteractiveDataDisplay_OneDll/images/map.PNG
Normal file
BIN
InteractiveDataDisplay_OneDll/images/map.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 MiB |
BIN
InteractiveDataDisplay_OneDll/images/markers.PNG
Normal file
BIN
InteractiveDataDisplay_OneDll/images/markers.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 72 KiB |
BIN
InteractiveDataDisplay_OneDll/images/sinline.PNG
Normal file
BIN
InteractiveDataDisplay_OneDll/images/sinline.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<Application x:Class="BarChartSample.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:BarChartSample"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace BarChartSample
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{F36872BF-8818-4019-A207-2B381C33C370}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<RootNamespace>BarChartSample</RootNamespace>
|
||||||
|
<AssemblyName>BarChartSample</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xaml">
|
||||||
|
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ApplicationDefinition Include="App.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</ApplicationDefinition>
|
||||||
|
<Page Include="MainWindow.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Compile Include="App.xaml.cs">
|
||||||
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="MainWindow.xaml.cs">
|
||||||
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\InteractiveDataDisplay.WPF.csproj">
|
||||||
|
<Project>{2d34544c-2df2-4b20-a43a-6c8d2df3dd82}</Project>
|
||||||
|
<Name>InteractiveDataDisplay.WPF</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<Window x:Class="BarChartSample.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d3="clr-namespace:InteractiveDataDisplay.WPF;assembly=InteractiveDataDisplay.WPF"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Bar chart" Height="600" Width="800">
|
||||||
|
<Grid>
|
||||||
|
<d3:Chart Name="plotter">
|
||||||
|
<d3:Chart.Title>
|
||||||
|
<TextBlock HorizontalAlignment="Center" FontSize="18" Margin="0,5,0,5">Bar chart sample</TextBlock>
|
||||||
|
</d3:Chart.Title>
|
||||||
|
<d3:BarGraph Name="barChart" Color="Blue"/>
|
||||||
|
</d3:Chart>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace BarChartSample
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
int N = 100;
|
||||||
|
double[] y = new double[N];
|
||||||
|
|
||||||
|
Random r = new Random();
|
||||||
|
double k;
|
||||||
|
|
||||||
|
for (int i = 0; i < N; i++)
|
||||||
|
{
|
||||||
|
k = r.NextDouble();
|
||||||
|
y[i] = k < 0.5 ? r.Next(100) : -r.Next(100);
|
||||||
|
}
|
||||||
|
barChart.PlotBars(y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("BarChartSample")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("BarChartSample")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
//In order to begin building localizable applications, set
|
||||||
|
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||||
|
//inside a <PropertyGroup>. For example, if you are using US english
|
||||||
|
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||||
|
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||||
|
//the line below to match the UICulture setting in the project file.
|
||||||
|
|
||||||
|
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||||
|
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
|
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
71
InteractiveDataDisplay_OneDll/samples/BarChartSample/Properties/Resources.Designer.cs
generated
Normal file
71
InteractiveDataDisplay_OneDll/samples/BarChartSample/Properties/Resources.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace BarChartSample.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||||
|
/// </summary>
|
||||||
|
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
|
// class via a tool like ResGen or Visual Studio.
|
||||||
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
|
// with the /str option, or rebuild your VS project.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources
|
||||||
|
{
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the cached ResourceManager instance used by this class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if ((resourceMan == null))
|
||||||
|
{
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BarChartSample.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides the current thread's CurrentUICulture property for all
|
||||||
|
/// resource lookups using this strongly typed resource class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
30
InteractiveDataDisplay_OneDll/samples/BarChartSample/Properties/Settings.Designer.cs
generated
Normal file
30
InteractiveDataDisplay_OneDll/samples/BarChartSample/Properties/Settings.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace BarChartSample.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<Application x:Class="BingMapsSample.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:BingMapsSample"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace BingMapsSample
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{C724F25D-6F77-48C0-A791-28E34E6B0F0C}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>BingMapsSample</RootNamespace>
|
||||||
|
<AssemblyName>BingMapsSample</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Microsoft.Maps.MapControl.WPF, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\sln\packages\Microsoft.Maps.MapControl.WPF.1.0.0.3\lib\net40-Client\Microsoft.Maps.MapControl.WPF.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xaml">
|
||||||
|
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ApplicationDefinition Include="App.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</ApplicationDefinition>
|
||||||
|
<Page Include="MainWindow.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Compile Include="App.xaml.cs">
|
||||||
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="MainWindow.xaml.cs">
|
||||||
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<AppDesigner Include="Properties\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\InteractiveDataDisplay.WPF.csproj">
|
||||||
|
<Project>{2d34544c-2df2-4b20-a43a-6c8d2df3dd82}</Project>
|
||||||
|
<Name>InteractiveDataDisplay.WPF</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<Window x:Class="BingMapsSample.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:BingMapsSample"
|
||||||
|
xmlns:m="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF"
|
||||||
|
xmlns:d3="clr-namespace:InteractiveDataDisplay.WPF;assembly=InteractiveDataDisplay.WPF"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Bing map" Height="600" Width="800">
|
||||||
|
|
||||||
|
<Grid x:Name="LayoutRoot" Background="White">
|
||||||
|
<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>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace BingMapsSample
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
plot.Tag = bingmap;
|
||||||
|
|
||||||
|
List<double> lat = new List<double>(), lon = new List<double>(), data = new List<double>();
|
||||||
|
using (var reader = new StreamReader(@"..\..\crop_area.csv"))
|
||||||
|
{
|
||||||
|
while (!reader.EndOfStream)
|
||||||
|
{
|
||||||
|
var line = reader.ReadLine();
|
||||||
|
var values = line.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
lon.Add(Double.Parse(values[0], CultureInfo.InvariantCulture));
|
||||||
|
lat.Add(Double.Parse(values[1], CultureInfo.InvariantCulture));
|
||||||
|
data.Add(Double.Parse(values[2], CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
markers.PlotColor(lon.ToArray(), lat.ToArray(), data.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("BingMapsSample")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("BingMapsSample")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
//In order to begin building localizable applications, set
|
||||||
|
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||||
|
//inside a <PropertyGroup>. For example, if you are using US english
|
||||||
|
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||||
|
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||||
|
//the line below to match the UICulture setting in the project file.
|
||||||
|
|
||||||
|
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||||
|
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
|
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
71
InteractiveDataDisplay_OneDll/samples/BingMapsSample/Properties/Resources.Designer.cs
generated
Normal file
71
InteractiveDataDisplay_OneDll/samples/BingMapsSample/Properties/Resources.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace BigMapsSample.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||||
|
/// </summary>
|
||||||
|
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
|
// class via a tool like ResGen or Visual Studio.
|
||||||
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
|
// with the /str option, or rebuild your VS project.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources
|
||||||
|
{
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the cached ResourceManager instance used by this class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if ((resourceMan == null))
|
||||||
|
{
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BigMapsSample.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides the current thread's CurrentUICulture property for all
|
||||||
|
/// resource lookups using this strongly typed resource class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
30
InteractiveDataDisplay_OneDll/samples/BingMapsSample/Properties/Settings.Designer.cs
generated
Normal file
30
InteractiveDataDisplay_OneDll/samples/BingMapsSample/Properties/Settings.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace BigMapsSample.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
||||||
2946
InteractiveDataDisplay_OneDll/samples/BingMapsSample/crop_area.csv
Normal file
2946
InteractiveDataDisplay_OneDll/samples/BingMapsSample/crop_area.csv
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Microsoft.Maps.MapControl.WPF" version="1.0.0.3" targetFramework="net452" />
|
||||||
|
</packages>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<Application x:Class="HeatmapSample.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:HeatmapSample"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace HeatmapSample
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{A59C204A-01D9-41A4-BE67-64ECDB991560}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<RootNamespace>HeatmapSample</RootNamespace>
|
||||||
|
<AssemblyName>HeatmapSample</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Reactive.Core, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Reactive.Core.3.1.1\lib\net45\System.Reactive.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Reactive.Interfaces, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Reactive.Interfaces.3.1.1\lib\net45\System.Reactive.Interfaces.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Reactive.Linq, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Reactive.Linq.3.1.1\lib\net45\System.Reactive.Linq.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Reactive.PlatformServices, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Reactive.PlatformServices.3.1.1\lib\net45\System.Reactive.PlatformServices.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Reactive.Windows.Threading, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Reactive.Windows.Threading.3.1.1\lib\net45\System.Reactive.Windows.Threading.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Windows" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xaml">
|
||||||
|
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ApplicationDefinition Include="App.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</ApplicationDefinition>
|
||||||
|
<Page Include="MainWindow.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Compile Include="App.xaml.cs">
|
||||||
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="MainWindow.xaml.cs">
|
||||||
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\InteractiveDataDisplay.WPF.csproj">
|
||||||
|
<Project>{2d34544c-2df2-4b20-a43a-6c8d2df3dd82}</Project>
|
||||||
|
<Name>InteractiveDataDisplay.WPF</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
<Window x:Class="HeatmapSample.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d3="clr-namespace:InteractiveDataDisplay.WPF;assembly=InteractiveDataDisplay.WPF"
|
||||||
|
Title="Heatmap" Height="600" Width="800">
|
||||||
|
<Grid>
|
||||||
|
<d3:Chart>
|
||||||
|
<d3:Chart.Title>
|
||||||
|
<TextBlock FontSize="18" Margin="0,5,0,5">Heatmap sample</TextBlock>
|
||||||
|
</d3:Chart.Title>
|
||||||
|
<d3:HeatmapGraph x:Name="heatmap" Palette="Yellow,Blue,Orange"/>
|
||||||
|
</d3:Chart>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Reactive.Linq;
|
||||||
|
|
||||||
|
namespace HeatmapSample
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
private volatile bool isUnloaded = false;
|
||||||
|
private AutoResetEvent renderComplete = new AutoResetEvent(false);
|
||||||
|
private Thread thread;
|
||||||
|
private double phase = 0;
|
||||||
|
|
||||||
|
const int N = 1000;
|
||||||
|
const int M = 500;
|
||||||
|
|
||||||
|
double[] x = new double[N + 1];
|
||||||
|
double[] y = new double[M + 1];
|
||||||
|
double[,] f = new double[N, M];
|
||||||
|
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
// Start computation thread when Page appears on the screen
|
||||||
|
Loaded += (s, e) =>
|
||||||
|
{
|
||||||
|
thread = new Thread(ModelRun);
|
||||||
|
isUnloaded = false;
|
||||||
|
thread.Start();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Stop computation thread when Page is removed from the screen
|
||||||
|
Closing += (s, e) =>
|
||||||
|
{
|
||||||
|
isUnloaded = true;
|
||||||
|
renderComplete.Set();
|
||||||
|
thread.Join();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ModelRun()
|
||||||
|
{
|
||||||
|
// Coordinate grid is constant
|
||||||
|
for (int i = 0; i <= N; i++)
|
||||||
|
x[i] = -Math.PI + 2 * i * Math.PI / N;
|
||||||
|
|
||||||
|
for (int j = 0; j <= M; j++)
|
||||||
|
y[j] = -Math.PI / 2 + j * Math.PI / M;
|
||||||
|
|
||||||
|
while (!isUnloaded) // Run until page is on the screen
|
||||||
|
{
|
||||||
|
// Data array is updated
|
||||||
|
for (int i = 0; i < N; i++)
|
||||||
|
for (int j = 0; j < M; j++)
|
||||||
|
f[i, j] = Math.Sqrt(x[i] * x[i] + y[j] * y[j]) * Math.Abs(Math.Cos(x[i] * x[i] + y[j] * y[j] + phase));
|
||||||
|
phase += 0.1;
|
||||||
|
|
||||||
|
// Uncomment next line to simulate delay in computations
|
||||||
|
// Thread.Sleep(1000);
|
||||||
|
|
||||||
|
// Plot the computed array.
|
||||||
|
// The Plot method must be called from the UI dispatcher thread.
|
||||||
|
// Unlike Tutoral3 sample here we wait for each frame to be rendered.
|
||||||
|
if (!isUnloaded)
|
||||||
|
{
|
||||||
|
renderComplete.Reset();
|
||||||
|
PlotDataDel handler = PlotData;
|
||||||
|
Dispatcher.BeginInvoke(handler);
|
||||||
|
renderComplete.WaitOne();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private delegate void PlotDataDel();
|
||||||
|
private void PlotData()
|
||||||
|
{
|
||||||
|
// HeatmapGraph objects prepare images to be drawn in a background thread.
|
||||||
|
// The Plot method cancels current incomplete images before starting a new one.
|
||||||
|
// This increases responsiveness of the UI but may result in loss of certain
|
||||||
|
// or even all of the frames.
|
||||||
|
// The following code shows how to wait until a certain data is actually drawn.
|
||||||
|
|
||||||
|
long id = heatmap.Plot(f, x, y); // receive a unique operation identifier
|
||||||
|
heatmap.RenderCompletion // an observable of completed and cancelled operations
|
||||||
|
.Where(rc => rc.TaskId == id) // filter out an operation with the known id
|
||||||
|
.Subscribe(dummy => { renderComplete.Set(); }); // signal when the id is observed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("HeatmapSample")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("HeatmapSample")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
//In order to begin building localizable applications, set
|
||||||
|
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||||
|
//inside a <PropertyGroup>. For example, if you are using US english
|
||||||
|
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||||
|
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||||
|
//the line below to match the UICulture setting in the project file.
|
||||||
|
|
||||||
|
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||||
|
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
|
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
71
InteractiveDataDisplay_OneDll/samples/HeatmapSample/Properties/Resources.Designer.cs
generated
Normal file
71
InteractiveDataDisplay_OneDll/samples/HeatmapSample/Properties/Resources.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace HeatmapSample.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||||
|
/// </summary>
|
||||||
|
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
|
// class via a tool like ResGen or Visual Studio.
|
||||||
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
|
// with the /str option, or rebuild your VS project.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources
|
||||||
|
{
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the cached ResourceManager instance used by this class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if ((resourceMan == null))
|
||||||
|
{
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HeatmapSample.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides the current thread's CurrentUICulture property for all
|
||||||
|
/// resource lookups using this strongly typed resource class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
30
InteractiveDataDisplay_OneDll/samples/HeatmapSample/Properties/Settings.Designer.cs
generated
Normal file
30
InteractiveDataDisplay_OneDll/samples/HeatmapSample/Properties/Settings.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace HeatmapSample.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="System.Reactive" version="3.1.1" targetFramework="net452" />
|
||||||
|
<package id="System.Reactive.Core" version="3.1.1" targetFramework="net452" />
|
||||||
|
<package id="System.Reactive.Interfaces" version="3.1.1" targetFramework="net452" />
|
||||||
|
<package id="System.Reactive.Linq" version="3.1.1" targetFramework="net452" />
|
||||||
|
<package id="System.Reactive.PlatformServices" version="3.1.1" targetFramework="net452" />
|
||||||
|
<package id="System.Reactive.Windows.Threading" version="3.1.1" targetFramework="net452" />
|
||||||
|
</packages>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<Application x:Class="LineGraphSample.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:LineGraphSample"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace LineGraphSample
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{284A7617-B70F-4A4A-B73A-1A8088B75926}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<RootNamespace>LineGraphSample</RootNamespace>
|
||||||
|
<AssemblyName>LineGraphSample</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xaml">
|
||||||
|
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ApplicationDefinition Include="App.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</ApplicationDefinition>
|
||||||
|
<Page Include="MainWindow.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Compile Include="App.xaml.cs">
|
||||||
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="MainWindow.xaml.cs">
|
||||||
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\InteractiveDataDisplay.WPF.csproj">
|
||||||
|
<Project>{2d34544c-2df2-4b20-a43a-6c8d2df3dd82}</Project>
|
||||||
|
<Name>InteractiveDataDisplay.WPF</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
<Window x:Class="LineGraphSample.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d3="clr-namespace:InteractiveDataDisplay.WPF;assembly=InteractiveDataDisplay.WPF"
|
||||||
|
xmlns:local="clr-namespace:LineGraphSample"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Line graph" Height="600" Width="800">
|
||||||
|
<Window.Resources>
|
||||||
|
<local:VisibilityToCheckedConverter x:Key="VisibilityToCheckedConverter"/>
|
||||||
|
</Window.Resources>
|
||||||
|
|
||||||
|
<Grid x:Name="LayoutRoot" Background="White">
|
||||||
|
<d3:Chart Name="plotter" IsXAxisReversed="True">
|
||||||
|
<d3:Chart.Title>
|
||||||
|
<TextBlock HorizontalAlignment="Center" FontSize="18" Margin="0,5,0,5">Line graph legend sample</TextBlock>
|
||||||
|
</d3:Chart.Title>
|
||||||
|
<d3:Chart.LegendContent>
|
||||||
|
<d3:LegendItemsPanel>
|
||||||
|
<d3:LegendItemsPanel.Resources>
|
||||||
|
<DataTemplate x:Key="InteractiveDataDisplay.WPF.LineGraph">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<CheckBox IsChecked="{Binding Path=Visibility, Converter={StaticResource VisibilityToCheckedConverter}, Mode=TwoWay}"/>
|
||||||
|
<Line Width="15" Height="15" X1="0" Y1="0" X2="15" Y2="15" Stroke="{Binding Path=Stroke}" StrokeThickness="2"/>
|
||||||
|
<TextBlock Margin="5,0,0,0" Text="{Binding Path=Description}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</d3:LegendItemsPanel.Resources>
|
||||||
|
</d3:LegendItemsPanel>
|
||||||
|
</d3:Chart.LegendContent>
|
||||||
|
<Grid Name="lines"/>
|
||||||
|
</d3:Chart>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using InteractiveDataDisplay.WPF;
|
||||||
|
|
||||||
|
namespace LineGraphSample
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
double[] x = new double[200];
|
||||||
|
for (int i = 0; i < x.Length; i++)
|
||||||
|
x[i] = 3.1415 * i / (x.Length - 1);
|
||||||
|
|
||||||
|
for (int i = 0; i < 25; i++)
|
||||||
|
{
|
||||||
|
var lg = new LineGraph();
|
||||||
|
lines.Children.Add(lg);
|
||||||
|
lg.Stroke = new SolidColorBrush(Color.FromArgb(255, 0, (byte)(i * 10), 0));
|
||||||
|
lg.Description = String.Format("Data series {0}", i + 1);
|
||||||
|
lg.StrokeThickness = 2;
|
||||||
|
lg.Plot(x, x.Select(v => Math.Sin(v + i / 10.0)).ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class VisibilityToCheckedConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||||
|
{
|
||||||
|
return ((Visibility)value) == Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||||
|
{
|
||||||
|
return ((bool)value) ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("LineGraphSample")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("LineGraphSample")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
//In order to begin building localizable applications, set
|
||||||
|
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||||
|
//inside a <PropertyGroup>. For example, if you are using US english
|
||||||
|
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||||
|
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||||
|
//the line below to match the UICulture setting in the project file.
|
||||||
|
|
||||||
|
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||||
|
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
|
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
71
InteractiveDataDisplay_OneDll/samples/LineGraphSample/Properties/Resources.Designer.cs
generated
Normal file
71
InteractiveDataDisplay_OneDll/samples/LineGraphSample/Properties/Resources.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace LineGraphSample.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||||
|
/// </summary>
|
||||||
|
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
|
// class via a tool like ResGen or Visual Studio.
|
||||||
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
|
// with the /str option, or rebuild your VS project.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources
|
||||||
|
{
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the cached ResourceManager instance used by this class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if ((resourceMan == null))
|
||||||
|
{
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LineGraphSample.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides the current thread's CurrentUICulture property for all
|
||||||
|
/// resource lookups using this strongly typed resource class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
30
InteractiveDataDisplay_OneDll/samples/LineGraphSample/Properties/Settings.Designer.cs
generated
Normal file
30
InteractiveDataDisplay_OneDll/samples/LineGraphSample/Properties/Settings.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace LineGraphSample.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<Application x:Class="MarkersSample.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:MarkersSample"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace MarkersSample
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<Window x:Class="MarkersSample.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d3="clr-namespace:InteractiveDataDisplay.WPF;assembly=InteractiveDataDisplay.WPF"
|
||||||
|
Title="Markers" Height="600" Width="800">
|
||||||
|
<Grid>
|
||||||
|
<d3:Chart Name="plotter">
|
||||||
|
<d3:Chart.Title>
|
||||||
|
<TextBlock HorizontalAlignment="Center" FontSize="18" Margin="0,5,0,5">Markers sample</TextBlock>
|
||||||
|
</d3:Chart.Title>
|
||||||
|
<d3:Plot>
|
||||||
|
<d3:CircleMarkerGraph Name="circles" Description="Species distribution"
|
||||||
|
ColorDescription="Population" SizeDescription="Age" Min="1" Max="20"/>
|
||||||
|
<d3:DiamondMarkerGraph Name="diamonds" Description="Species distribution" ColorDescription="Population" SizeDescription="Age" Min="1" Max="20"/>
|
||||||
|
</d3:Plot>
|
||||||
|
</d3:Chart>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace MarkersSample
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
const int N =100;
|
||||||
|
const int M = 1000;
|
||||||
|
double[] x = new double[N];
|
||||||
|
double[] y = new double[N];
|
||||||
|
double[] c = new double[N];
|
||||||
|
double[] d = new double[N];
|
||||||
|
|
||||||
|
Random rand = new Random();
|
||||||
|
//circles
|
||||||
|
for (int i = 0; i < N; i++)
|
||||||
|
{
|
||||||
|
x[i] = rand.Next(M);
|
||||||
|
y[i] = rand.Next(M);
|
||||||
|
c[i] = rand.NextDouble();
|
||||||
|
d[i] = 20 * rand.NextDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
circles.PlotColorSize(x, y, c, d);
|
||||||
|
//diamonds
|
||||||
|
x = new double[N];
|
||||||
|
y = new double[N];
|
||||||
|
c = new double[N];
|
||||||
|
d = new double[N];
|
||||||
|
|
||||||
|
for (int i = 0; i < N; i++)
|
||||||
|
{
|
||||||
|
x[i] = rand.Next(M);
|
||||||
|
y[i] = rand.Next(M);
|
||||||
|
c[i] = rand.NextDouble();
|
||||||
|
d[i] = 20 * rand.NextDouble();
|
||||||
|
}
|
||||||
|
diamonds.PlotColorSize(x, y, c, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{4BEA4B4C-5B83-4FD7-B9BF-3AE4F1CC571F}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<RootNamespace>MarkersSample</RootNamespace>
|
||||||
|
<AssemblyName>MarkersSample</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xaml">
|
||||||
|
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ApplicationDefinition Include="App.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</ApplicationDefinition>
|
||||||
|
<Page Include="MainWindow.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Compile Include="App.xaml.cs">
|
||||||
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="MainWindow.xaml.cs">
|
||||||
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\InteractiveDataDisplay.WPF.csproj">
|
||||||
|
<Project>{2d34544c-2df2-4b20-a43a-6c8d2df3dd82}</Project>
|
||||||
|
<Name>InteractiveDataDisplay.WPF</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("MarkersSample")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("MarkersSample")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
//In order to begin building localizable applications, set
|
||||||
|
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||||
|
//inside a <PropertyGroup>. For example, if you are using US english
|
||||||
|
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||||
|
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||||
|
//the line below to match the UICulture setting in the project file.
|
||||||
|
|
||||||
|
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||||
|
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
|
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
71
InteractiveDataDisplay_OneDll/samples/MarkersSample/Properties/Resources.Designer.cs
generated
Normal file
71
InteractiveDataDisplay_OneDll/samples/MarkersSample/Properties/Resources.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace MarkersSample.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||||
|
/// </summary>
|
||||||
|
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
|
// class via a tool like ResGen or Visual Studio.
|
||||||
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
|
// with the /str option, or rebuild your VS project.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources
|
||||||
|
{
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the cached ResourceManager instance used by this class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if ((resourceMan == null))
|
||||||
|
{
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MarkersSample.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides the current thread's CurrentUICulture property for all
|
||||||
|
/// resource lookups using this strongly typed resource class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
30
InteractiveDataDisplay_OneDll/samples/MarkersSample/Properties/Settings.Designer.cs
generated
Normal file
30
InteractiveDataDisplay_OneDll/samples/MarkersSample/Properties/Settings.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace MarkersSample.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<Application x:Class="SyncGraphsSample.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:SyncGraphsSample"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace SyncGraphsSample
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
<Window x:Class="SyncGraphsSample.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d3="clr-namespace:InteractiveDataDisplay.WPF;assembly=InteractiveDataDisplay.WPF"
|
||||||
|
xmlns:local="clr-namespace:SyncGraphsSample"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Sync graphs" Height="600" Width="800">
|
||||||
|
<Grid x:Name="LayoutRoot" Background="White">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="5"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="5"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="0" Grid.ColumnSpan="4" Text="Syncronized figures sample" TextAlignment="Center" FontSize="18" Margin="5"/>
|
||||||
|
|
||||||
|
<d3:Figure x:Name="leftPlotter" Grid.Row="1" Grid.Column="1" PlotOriginY="{Binding PlotOriginY,ElementName=centerPlotter,Mode=TwoWay}" PlotHeight="{Binding PlotHeight,ElementName=centerPlotter,Mode=TwoWay}">
|
||||||
|
<d3:PlotAxis AxisOrientation="Left" d3:Figure.Placement="Left"/>
|
||||||
|
<d3:PlotAxis AxisOrientation="Top" d3:Figure.Placement="Top"/>
|
||||||
|
<d3:CircleMarkerGraph x:Name="circles"/>
|
||||||
|
<d3:MouseNavigation/>
|
||||||
|
<Border BorderThickness="0.5" BorderBrush="Black"/>
|
||||||
|
</d3:Figure>
|
||||||
|
|
||||||
|
<d3:Figure x:Name="centerPlotter" Grid.Column="3" Grid.Row="1">
|
||||||
|
<d3:PlotAxis AxisOrientation="Right" d3:Figure.Placement="Right"/>
|
||||||
|
<d3:PlotAxis AxisOrientation="Top" d3:Figure.Placement="Top"/>
|
||||||
|
<d3:LineGraph x:Name="lineGraph1"/>
|
||||||
|
<d3:MouseNavigation/>
|
||||||
|
<Border BorderThickness="0.5" BorderBrush="Black"/>
|
||||||
|
</d3:Figure>
|
||||||
|
|
||||||
|
<d3:Figure x:Name="bottomPlotter" Grid.Column="3" Grid.Row="3" PlotOriginX="{Binding PlotOriginX,ElementName=centerPlotter,Mode=TwoWay}" PlotWidth="{Binding PlotWidth,ElementName=centerPlotter,Mode=TwoWay}">
|
||||||
|
<d3:PlotAxis AxisOrientation="Right" d3:Figure.Placement="Right"/>
|
||||||
|
<d3:PlotAxis AxisOrientation="Bottom" d3:Figure.Placement="Bottom"/>
|
||||||
|
<d3:MouseNavigation/>
|
||||||
|
<d3:BarGraph x:Name="barGraph"/>
|
||||||
|
<Border BorderThickness="0.5" BorderBrush="Black"/>
|
||||||
|
</d3:Figure>
|
||||||
|
|
||||||
|
<ContentControl Grid.Column="1" Grid.Row="3" VerticalContentAlignment="Center"
|
||||||
|
HorizontalContentAlignment="Center" Margin="20,20,20,20">
|
||||||
|
<TextBlock FontSize="14" TextWrapping="Wrap" TextAlignment="Center" >These three Charts have shared axes. Two of the share
|
||||||
|
vertical axis, two - horizontal. Navigate in one plot and see how other is changed. This is done purely in
|
||||||
|
XAML.</TextBlock>
|
||||||
|
</ContentControl>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace SyncGraphsSample
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
barGraph.PlotBars(Enumerable.Range(1, 10));
|
||||||
|
|
||||||
|
int N = 25;
|
||||||
|
Random r = new Random();
|
||||||
|
double[] x = new double[N];
|
||||||
|
double[] y = new double[N];
|
||||||
|
for (int i = 0; i < N; i++)
|
||||||
|
{
|
||||||
|
x[i] = r.NextDouble() * 12 - 1;
|
||||||
|
y[i] = r.NextDouble() * 12 - 1;
|
||||||
|
}
|
||||||
|
circles.PlotXY(x, y);
|
||||||
|
|
||||||
|
double[] x1 = Enumerable.Range(0, 90).Select(i => i / 10.0).ToArray();
|
||||||
|
double[] y1 = x1.Select(v => 7 * (Math.Abs(v) < 1e-10 ? 1 : Math.Sin(v) / v) + 1).ToArray();
|
||||||
|
lineGraph1.Stroke = new SolidColorBrush(Colors.Green);
|
||||||
|
lineGraph1.StrokeThickness = 2.0;
|
||||||
|
lineGraph1.Plot(x1, y1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("SyncGraphsSample")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("SyncGraphsSample")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
//In order to begin building localizable applications, set
|
||||||
|
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||||
|
//inside a <PropertyGroup>. For example, if you are using US english
|
||||||
|
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||||
|
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||||
|
//the line below to match the UICulture setting in the project file.
|
||||||
|
|
||||||
|
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||||
|
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
|
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
63
InteractiveDataDisplay_OneDll/samples/SyncGraphsSample/Properties/Resources.Designer.cs
generated
Normal file
63
InteractiveDataDisplay_OneDll/samples/SyncGraphsSample/Properties/Resources.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программой.
|
||||||
|
// Исполняемая версия:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
|
// повторной генерации кода.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace SyncGraphsSample.Properties {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||||
|
/// </summary>
|
||||||
|
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||||
|
// с помощью такого средства, как ResGen или Visual Studio.
|
||||||
|
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||||
|
// с параметром /str или перестройте свой проект VS.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources {
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
|
get {
|
||||||
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SyncGraphsSample.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||||
|
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
26
InteractiveDataDisplay_OneDll/samples/SyncGraphsSample/Properties/Settings.Designer.cs
generated
Normal file
26
InteractiveDataDisplay_OneDll/samples/SyncGraphsSample/Properties/Settings.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программой.
|
||||||
|
// Исполняемая версия:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
|
// повторной генерации кода.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace SyncGraphsSample.Properties {
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default {
|
||||||
|
get {
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{0C4C6C54-F253-4FD2-8B38-75E476882A4B}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>SyncGraphsSample</RootNamespace>
|
||||||
|
<AssemblyName>SyncGraphsSample</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xaml">
|
||||||
|
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ApplicationDefinition Include="App.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</ApplicationDefinition>
|
||||||
|
<Page Include="MainWindow.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Compile Include="App.xaml.cs">
|
||||||
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="MainWindow.xaml.cs">
|
||||||
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<AppDesigner Include="Properties\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\InteractiveDataDisplay.WPF.csproj">
|
||||||
|
<Project>{2d34544c-2df2-4b20-a43a-6c8d2df3dd82}</Project>
|
||||||
|
<Name>InteractiveDataDisplay.WPF</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.31313.79
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InteractiveDataDisplay.WPF", "..\src\InteractiveDataDisplay.WPF.csproj", "{2D34544C-2DF2-4B20-A43A-6C8D2DF3DD82}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{6E637A98-DA68-40CF-B194-56CEB99A57A0}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarkersSample", "..\samples\MarkersSample\MarkersSample.csproj", "{4BEA4B4C-5B83-4FD7-B9BF-3AE4F1CC571F}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LineGraphSample", "..\samples\LineGraphSample\LineGraphSample.csproj", "{284A7617-B70F-4A4A-B73A-1A8088B75926}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BarChartSample", "..\samples\BarChartSample\BarChartSample.csproj", "{F36872BF-8818-4019-A207-2B381C33C370}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SyncGraphsSample", "..\samples\SyncGraphsSample\SyncGraphsSample.csproj", "{0C4C6C54-F253-4FD2-8B38-75E476882A4B}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{2D34544C-2DF2-4B20-A43A-6C8D2DF3DD82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{2D34544C-2DF2-4B20-A43A-6C8D2DF3DD82}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{2D34544C-2DF2-4B20-A43A-6C8D2DF3DD82}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{2D34544C-2DF2-4B20-A43A-6C8D2DF3DD82}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{4BEA4B4C-5B83-4FD7-B9BF-3AE4F1CC571F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4BEA4B4C-5B83-4FD7-B9BF-3AE4F1CC571F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4BEA4B4C-5B83-4FD7-B9BF-3AE4F1CC571F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4BEA4B4C-5B83-4FD7-B9BF-3AE4F1CC571F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{284A7617-B70F-4A4A-B73A-1A8088B75926}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{284A7617-B70F-4A4A-B73A-1A8088B75926}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{284A7617-B70F-4A4A-B73A-1A8088B75926}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{284A7617-B70F-4A4A-B73A-1A8088B75926}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{F36872BF-8818-4019-A207-2B381C33C370}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F36872BF-8818-4019-A207-2B381C33C370}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F36872BF-8818-4019-A207-2B381C33C370}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F36872BF-8818-4019-A207-2B381C33C370}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{0C4C6C54-F253-4FD2-8B38-75E476882A4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{0C4C6C54-F253-4FD2-8B38-75E476882A4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{0C4C6C54-F253-4FD2-8B38-75E476882A4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{0C4C6C54-F253-4FD2-8B38-75E476882A4B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
{4BEA4B4C-5B83-4FD7-B9BF-3AE4F1CC571F} = {6E637A98-DA68-40CF-B194-56CEB99A57A0}
|
||||||
|
{284A7617-B70F-4A4A-B73A-1A8088B75926} = {6E637A98-DA68-40CF-B194-56CEB99A57A0}
|
||||||
|
{F36872BF-8818-4019-A207-2B381C33C370} = {6E637A98-DA68-40CF-B194-56CEB99A57A0}
|
||||||
|
{0C4C6C54-F253-4FD2-8B38-75E476882A4B} = {6E637A98-DA68-40CF-B194-56CEB99A57A0}
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {206EA3D1-9D79-4D18-BE4A-C941D2C4BDEF}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
656
InteractiveDataDisplay_OneDll/src/Axes/Axis.cs
Normal file
656
InteractiveDataDisplay_OneDll/src/Axes/Axis.cs
Normal file
|
|
@ -0,0 +1,656 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
/// <summary>Facilitates drawing of vertical or horizontal coordinate axis</summary>
|
||||||
|
[Description("Vertical or horizontal coordinate axis")]
|
||||||
|
public class Axis : Panel
|
||||||
|
{
|
||||||
|
private ILabelProvider labelProvider;
|
||||||
|
private TicksProvider ticksProvider;
|
||||||
|
private Path majorTicksPath;
|
||||||
|
private Path minorTicksPath;
|
||||||
|
|
||||||
|
private FrameworkElement[] labels;
|
||||||
|
|
||||||
|
private const int maxTickArrangeIterations = 12;
|
||||||
|
private int maxTicks = 20;
|
||||||
|
private const double increaseRatio = 8.0;
|
||||||
|
private const double decreaseRatio = 8.0;
|
||||||
|
private const double tickLength = 10;
|
||||||
|
|
||||||
|
private bool drawTicks = true;
|
||||||
|
private bool drawMinorTicks = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="Axis"/> class with double <see cref="LabelProvider"/>
|
||||||
|
/// and <see cref="TicksProvider"/>.
|
||||||
|
/// </summary>
|
||||||
|
public Axis()
|
||||||
|
{
|
||||||
|
DataTransform = new IdentityDataTransform();
|
||||||
|
Ticks = new double[0];
|
||||||
|
|
||||||
|
majorTicksPath = new Path();
|
||||||
|
minorTicksPath = new Path();
|
||||||
|
Children.Add(majorTicksPath);
|
||||||
|
Children.Add(minorTicksPath);
|
||||||
|
|
||||||
|
BindingOperations.SetBinding(majorTicksPath, Path.StrokeProperty, new Binding("Foreground") { Source = this, Mode = BindingMode.TwoWay });
|
||||||
|
BindingOperations.SetBinding(minorTicksPath, Path.StrokeProperty, new Binding("Foreground") { Source = this, Mode = BindingMode.TwoWay });
|
||||||
|
|
||||||
|
if (labelProvider == null)
|
||||||
|
this.labelProvider = new LabelProvider();
|
||||||
|
if (ticksProvider == null)
|
||||||
|
this.ticksProvider = new TicksProvider();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="Axis"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="labelProvider">A <see cref="LabelProvider"/> to create labels.</param>
|
||||||
|
/// <param name="ticksProvider">A <see cref="TicksProvider"/> to create ticks.</param>
|
||||||
|
public Axis(ILabelProvider labelProvider, TicksProvider ticksProvider)
|
||||||
|
: this()
|
||||||
|
{
|
||||||
|
this.labelProvider = labelProvider;
|
||||||
|
this.ticksProvider = ticksProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a set of double values displayed as axis ticks in data values.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Ticks are calculated from current Range of axis in plot coordinates and current DataTransform of axis.
|
||||||
|
/// Example: for range [-1,1] int plot coordinates and DataTransform as y = 0.001 * x + 0.5 values of Ticks will be in [-1000,1000] range
|
||||||
|
/// It is not recommended to set this property manually.
|
||||||
|
/// </remarks>
|
||||||
|
[Browsable(false)]
|
||||||
|
public IEnumerable<double> Ticks
|
||||||
|
{
|
||||||
|
get { return (IEnumerable<double>)GetValue(TicksProperty); }
|
||||||
|
set { SetValue(TicksProperty, value); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the <see cref="Ticks"/> dependency property.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty TicksProperty =
|
||||||
|
DependencyProperty.Register("Ticks", typeof(IEnumerable<double>), typeof(Axis), new PropertyMetadata(new double[0]));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the range of values on axis in plot coordinates.
|
||||||
|
/// </summary>
|
||||||
|
///<remarks>
|
||||||
|
/// <see cref="Range"/> should be inside Domain of <see cref="DataTransform"/>, otherwise exception will be thrown.
|
||||||
|
///</remarks>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
[Description("Range of values on axis")]
|
||||||
|
public Range Range
|
||||||
|
{
|
||||||
|
get { return (Range)GetValue(RangeProperty); }
|
||||||
|
set { SetValue(RangeProperty, value); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the <see cref="Range"/> dependency property.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty RangeProperty =
|
||||||
|
DependencyProperty.Register("Range", typeof(Range), typeof(Axis), new PropertyMetadata(new Range(0, 1),
|
||||||
|
(o, e) =>
|
||||||
|
{
|
||||||
|
Axis axis = (Axis)o;
|
||||||
|
if (axis != null)
|
||||||
|
{
|
||||||
|
axis.InvalidateMeasure();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets orientation of the axis and location of labels
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>The default AxisOrientation is AxisOrientation.Bottom</remarks>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
[Description("Defines orientation of axis and location of labels")]
|
||||||
|
public AxisOrientation AxisOrientation
|
||||||
|
{
|
||||||
|
get { return (AxisOrientation)GetValue(AxisOrientationProperty); }
|
||||||
|
set { SetValue(AxisOrientationProperty, value); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the <see cref="AxisOrientation"/> dependency property.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty AxisOrientationProperty =
|
||||||
|
DependencyProperty.Register("AxisOrientation", typeof(AxisOrientation), typeof(Axis), new PropertyMetadata(AxisOrientation.Bottom,
|
||||||
|
(o, e) =>
|
||||||
|
{
|
||||||
|
Axis axis = (Axis)o;
|
||||||
|
if (axis != null)
|
||||||
|
{
|
||||||
|
axis.InvalidateMeasure();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a flag indicating whether the axis is reversed or not.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Axis is not reversed by default.</remarks>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
[Description("Defines orientation of axis and location of labels")]
|
||||||
|
public bool IsReversed
|
||||||
|
{
|
||||||
|
get { return (bool)GetValue(IsReversedProperty); }
|
||||||
|
set { SetValue(IsReversedProperty, value); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the <see cref="IsReversed"/> dependency property.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty IsReversedProperty =
|
||||||
|
DependencyProperty.Register("IsReversed", typeof(bool), typeof(Axis), new PropertyMetadata(false,
|
||||||
|
(o, e) =>
|
||||||
|
{
|
||||||
|
Axis axis = (Axis)o;
|
||||||
|
if (axis != null)
|
||||||
|
{
|
||||||
|
axis.InvalidateMeasure();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets <see cref="DataTransform"/> for an axis.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// The default transform is <see cref="IdentityDataTransform"/>
|
||||||
|
/// DataTransform is used for transform plot coordinates from Range property to data values, which will be displayed on ticks
|
||||||
|
/// </remarks>
|
||||||
|
[Description("Transform from data to plot coordinates")]
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public DataTransform DataTransform
|
||||||
|
{
|
||||||
|
get { return (DataTransform)GetValue(DataTransformProperty); }
|
||||||
|
set { SetValue(DataTransformProperty, value); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the <see cref="DataTransform"/> dependency property.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty DataTransformProperty =
|
||||||
|
DependencyProperty.Register("DataTransform", typeof(DataTransform), typeof(Axis), new PropertyMetadata(null,
|
||||||
|
(o, e) =>
|
||||||
|
{
|
||||||
|
Axis axis = (Axis)o;
|
||||||
|
if (axis != null)
|
||||||
|
{
|
||||||
|
axis.InvalidateMeasure();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the brush for labels and ticks of axis
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>The default foreground is black</remarks>
|
||||||
|
[Category("Appearance")]
|
||||||
|
[Description("Brush for labels and ticks")]
|
||||||
|
public SolidColorBrush Foreground
|
||||||
|
{
|
||||||
|
get { return (SolidColorBrush)GetValue(ForegroundProperty); }
|
||||||
|
set { SetValue(ForegroundProperty, value); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the <see cref="Foreground"/> dependency property.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty ForegroundProperty =
|
||||||
|
DependencyProperty.Register("Foreground", typeof(SolidColorBrush), typeof(Axis), new PropertyMetadata(new SolidColorBrush(Colors.Black)));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the maximum possible count of ticks.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>The defalut count is 20</remarks>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
[Description("Maximum number of major ticks")]
|
||||||
|
public int MaxTicks
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
maxTicks = value;
|
||||||
|
InvalidateMeasure();
|
||||||
|
}
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return maxTicks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether the ticks should be rendered or not.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>The default value is true.</remarks>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public bool AreTicksVisible
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
drawTicks = value;
|
||||||
|
drawMinorTicks = value;
|
||||||
|
if (drawTicks)
|
||||||
|
InvalidateMeasure();
|
||||||
|
}
|
||||||
|
get { return drawTicks; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether the minor ticks should be rendered or not.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>The default value is true.</remarks>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public bool AreMinorTicksVisible
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
drawMinorTicks = value;
|
||||||
|
if (drawMinorTicks)
|
||||||
|
InvalidateMeasure();
|
||||||
|
}
|
||||||
|
get { return drawMinorTicks; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateTicks(Size axisSize)
|
||||||
|
{
|
||||||
|
Range range = new Range(
|
||||||
|
DataTransform.PlotToData(Double.IsInfinity(Range.Min) || Double.IsNaN(Range.Min) ? 0 : Range.Min),
|
||||||
|
DataTransform.PlotToData(Double.IsInfinity(Range.Max) || Double.IsNaN(Range.Max) ? 1 : Range.Max));
|
||||||
|
|
||||||
|
// One tick if range is point
|
||||||
|
if (range.IsPoint)
|
||||||
|
{
|
||||||
|
var t = new double[] { range.Min };
|
||||||
|
Ticks = t;
|
||||||
|
labels = labelProvider.GetLabels(t);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do first pass of ticks arrangement
|
||||||
|
ticksProvider.Range = range;
|
||||||
|
double[] ticks = ticksProvider.GetTicks();
|
||||||
|
labels = labelProvider.GetLabels(ticks);
|
||||||
|
|
||||||
|
TickChange result;
|
||||||
|
if (ticks.Length > MaxTicks)
|
||||||
|
result = TickChange.Decrease;
|
||||||
|
else if (ticks.Length < 2)
|
||||||
|
result = TickChange.Increase;
|
||||||
|
else
|
||||||
|
result = CheckLabelsArrangement(axisSize, labels, ticks);
|
||||||
|
|
||||||
|
int iterations = 0;
|
||||||
|
int prevLength = ticks.Length;
|
||||||
|
while (result != TickChange.OK && iterations++ < maxTickArrangeIterations)
|
||||||
|
{
|
||||||
|
if (result == TickChange.Increase)
|
||||||
|
ticksProvider.IncreaseTickCount();
|
||||||
|
else
|
||||||
|
ticksProvider.DecreaseTickCount();
|
||||||
|
double[] newTicks = ticksProvider.GetTicks();
|
||||||
|
if (newTicks.Length > MaxTicks && result == TickChange.Increase)
|
||||||
|
{
|
||||||
|
ticksProvider.DecreaseTickCount(); // Step back and stop to not get more than MaxTicks
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (newTicks.Length < 2 && result == TickChange.Decrease)
|
||||||
|
{
|
||||||
|
ticksProvider.IncreaseTickCount(); // Step back and stop to not get less than 2
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
var prevTicks = ticks;
|
||||||
|
ticks = newTicks;
|
||||||
|
var prevLabels = labels;
|
||||||
|
labels = labelProvider.GetLabels(newTicks);
|
||||||
|
var newResult = CheckLabelsArrangement(axisSize, labels, ticks);
|
||||||
|
if (newResult == result) // Continue in the same direction
|
||||||
|
{
|
||||||
|
prevLength = newTicks.Length;
|
||||||
|
}
|
||||||
|
else // Direction changed or layout OK - stop the loop
|
||||||
|
{
|
||||||
|
if (newResult != TickChange.OK) // Direction changed - time to stop
|
||||||
|
{
|
||||||
|
if (result == TickChange.Decrease)
|
||||||
|
{
|
||||||
|
if (prevLength < MaxTicks)
|
||||||
|
{
|
||||||
|
ticks = prevTicks;
|
||||||
|
labels = prevLabels;
|
||||||
|
ticksProvider.IncreaseTickCount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (prevLength >= 2)
|
||||||
|
{
|
||||||
|
ticks = prevTicks;
|
||||||
|
labels = prevLabels;
|
||||||
|
ticksProvider.DecreaseTickCount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ticks = ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawCanvas(Size axisSize, double[] cTicks)
|
||||||
|
{
|
||||||
|
double length = IsHorizontal ? axisSize.Width : axisSize.Height;
|
||||||
|
|
||||||
|
GeometryGroup majorTicksGeometry = new GeometryGroup();
|
||||||
|
GeometryGroup minorTicksGeometry = new GeometryGroup();
|
||||||
|
|
||||||
|
if (!Double.IsNaN(length) && length != 0)
|
||||||
|
{
|
||||||
|
int start = 0;
|
||||||
|
if (cTicks.Length > 0 && cTicks[0] < Range.Min) start++;
|
||||||
|
|
||||||
|
if (Range.IsPoint)
|
||||||
|
drawMinorTicks = false;
|
||||||
|
|
||||||
|
for (int i = start; i < cTicks.Length; i++)
|
||||||
|
{
|
||||||
|
LineGeometry line = new LineGeometry();
|
||||||
|
majorTicksGeometry.Children.Add(line);
|
||||||
|
|
||||||
|
if (IsHorizontal)
|
||||||
|
{
|
||||||
|
line.StartPoint = new Point(GetCoordinateFromTick(cTicks[i], axisSize), 0);
|
||||||
|
line.EndPoint = new Point(GetCoordinateFromTick(cTicks[i], axisSize), tickLength);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
line.StartPoint = new Point(0, GetCoordinateFromTick(cTicks[i], axisSize));
|
||||||
|
line.EndPoint = new Point(tickLength, GetCoordinateFromTick(cTicks[i], axisSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (labels[i] is TextBlock)
|
||||||
|
{
|
||||||
|
(labels[i] as TextBlock).Foreground = Foreground;
|
||||||
|
}
|
||||||
|
else if (labels[i] is Control)
|
||||||
|
{
|
||||||
|
(labels[i] as Control).Foreground = Foreground;
|
||||||
|
}
|
||||||
|
|
||||||
|
Children.Add(labels[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drawMinorTicks)
|
||||||
|
{
|
||||||
|
double[] minorTicks = ticksProvider.GetMinorTicks(Range);
|
||||||
|
if (minorTicks != null)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < minorTicks.Length; j++)
|
||||||
|
{
|
||||||
|
LineGeometry line = new LineGeometry();
|
||||||
|
minorTicksGeometry.Children.Add(line);
|
||||||
|
|
||||||
|
if (IsHorizontal)
|
||||||
|
{
|
||||||
|
line.StartPoint = new Point(GetCoordinateFromTick(minorTicks[j], axisSize), 0);
|
||||||
|
line.EndPoint = new Point(GetCoordinateFromTick(minorTicks[j], axisSize), tickLength / 2.0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
line.StartPoint = new Point(0, GetCoordinateFromTick(minorTicks[j], axisSize));
|
||||||
|
line.EndPoint = new Point(tickLength / 2.0, GetCoordinateFromTick(minorTicks[j], axisSize));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
majorTicksPath.Data = majorTicksGeometry;
|
||||||
|
minorTicksPath.Data = minorTicksGeometry;
|
||||||
|
|
||||||
|
if (!drawMinorTicks)
|
||||||
|
drawMinorTicks = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Positions child elements and determines a size for a Figure.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="finalSize">The final area within the parent that Figure should use to arrange itself and its children.</param>
|
||||||
|
/// <returns>The actual size used.</returns>
|
||||||
|
protected override Size ArrangeOverride(Size finalSize)
|
||||||
|
{
|
||||||
|
finalSize.Width = Math.Min(DesiredSize.Width, finalSize.Width);
|
||||||
|
finalSize.Height = Math.Min(DesiredSize.Height, finalSize.Height);
|
||||||
|
|
||||||
|
double labelArrangeOriginX = 0;
|
||||||
|
double labelArrangeOriginY = 0;
|
||||||
|
|
||||||
|
|
||||||
|
switch (AxisOrientation)
|
||||||
|
{
|
||||||
|
case AxisOrientation.Top:
|
||||||
|
majorTicksPath.Arrange(new Rect(0, finalSize.Height - tickLength, finalSize.Width, tickLength));
|
||||||
|
minorTicksPath.Arrange(new Rect(0, finalSize.Height - tickLength / 2.0, finalSize.Width, tickLength / 2.0));
|
||||||
|
break;
|
||||||
|
case AxisOrientation.Bottom:
|
||||||
|
majorTicksPath.Arrange(new Rect(0, 0, finalSize.Width, tickLength));
|
||||||
|
minorTicksPath.Arrange(new Rect(0, 0, finalSize.Width, tickLength / 2.0));
|
||||||
|
break;
|
||||||
|
case AxisOrientation.Right:
|
||||||
|
majorTicksPath.Arrange(new Rect(0, 0, tickLength, finalSize.Height));
|
||||||
|
minorTicksPath.Arrange(new Rect(0, 0, tickLength / 2.0, finalSize.Height));
|
||||||
|
break;
|
||||||
|
case AxisOrientation.Left:
|
||||||
|
majorTicksPath.Arrange(new Rect(Math.Max(0, finalSize.Width - tickLength), 0, tickLength, finalSize.Height));
|
||||||
|
minorTicksPath.Arrange(new Rect(Math.Max(0, finalSize.Width - tickLength / 2.0), 0, tickLength / 2.0, finalSize.Height));
|
||||||
|
labelArrangeOriginX = finalSize.Width - tickLength - CalculateMaxLabelWidth();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var label in labels)
|
||||||
|
{
|
||||||
|
label.Arrange(new Rect(labelArrangeOriginX, labelArrangeOriginY, label.DesiredSize.Width, label.DesiredSize.Height));
|
||||||
|
}
|
||||||
|
|
||||||
|
return finalSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Measures the size in layout required for child elements and determines a size for the Figure.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="availableSize">The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available.</param>
|
||||||
|
/// <returns>The size that this element determines it needs during layout, based on its calculations of child element sizes.</returns>
|
||||||
|
protected override Size MeasureOverride(Size availableSize)
|
||||||
|
{
|
||||||
|
if (Double.IsInfinity(availableSize.Width))
|
||||||
|
availableSize.Width = 128;
|
||||||
|
if (Double.IsInfinity(availableSize.Height))
|
||||||
|
availableSize.Height = 128;
|
||||||
|
|
||||||
|
|
||||||
|
Size effectiveSize = availableSize;
|
||||||
|
|
||||||
|
|
||||||
|
ClearLabels();
|
||||||
|
CreateTicks(effectiveSize);
|
||||||
|
|
||||||
|
double[] cTicks = Ticks.ToArray();
|
||||||
|
DrawCanvas(effectiveSize, cTicks);
|
||||||
|
|
||||||
|
foreach (UIElement child in Children)
|
||||||
|
{
|
||||||
|
child.Measure(availableSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
double maxLabelWidth = CalculateMaxLabelWidth();
|
||||||
|
double maxLabelHeight = CalculateMaxLabelHeight();
|
||||||
|
|
||||||
|
switch (AxisOrientation)
|
||||||
|
{
|
||||||
|
case AxisOrientation.Top:
|
||||||
|
|
||||||
|
for (int i = 0; i < labels.Length; i++)
|
||||||
|
{
|
||||||
|
labels[i].RenderTransform = new TranslateTransform { X = GetCoordinateFromTick(cTicks[i], effectiveSize) - labels[i].DesiredSize.Width / 2, Y = 0 };
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case AxisOrientation.Bottom:
|
||||||
|
for (int i = 0; i < labels.Length; i++)
|
||||||
|
{
|
||||||
|
labels[i].RenderTransform = new TranslateTransform { X = GetCoordinateFromTick(cTicks[i], effectiveSize) - labels[i].DesiredSize.Width / 2, Y = majorTicksPath.DesiredSize.Height };
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case AxisOrientation.Right:
|
||||||
|
for (int i = 0; i < labels.Length; i++)
|
||||||
|
{
|
||||||
|
labels[i].RenderTransform = new TranslateTransform { X = majorTicksPath.DesiredSize.Width, Y = GetCoordinateFromTick(cTicks[i], effectiveSize) - labels[i].DesiredSize.Height / 2 };
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case AxisOrientation.Left:
|
||||||
|
for (int i = 0; i < labels.Length; i++)
|
||||||
|
{
|
||||||
|
labels[i].RenderTransform = new TranslateTransform { X = maxLabelWidth - labels[i].DesiredSize.Width, Y = GetCoordinateFromTick(cTicks[i], effectiveSize) - labels[i].DesiredSize.Height / 2 };
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsHorizontal)
|
||||||
|
{
|
||||||
|
availableSize.Height = majorTicksPath.DesiredSize.Height + maxLabelHeight;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
availableSize.Width = majorTicksPath.DesiredSize.Width + maxLabelWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
return availableSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClearLabels()
|
||||||
|
{
|
||||||
|
if (labels != null)
|
||||||
|
{
|
||||||
|
foreach (var elt in labels)
|
||||||
|
{
|
||||||
|
if (Children.Contains(elt))
|
||||||
|
Children.Remove(elt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private double CalculateMaxLabelHeight()
|
||||||
|
{
|
||||||
|
if (labels != null)
|
||||||
|
{
|
||||||
|
double max = 0;
|
||||||
|
for (int i = 0; i < labels.Length; i++)
|
||||||
|
if (Children.Contains(labels[i]) && labels[i].DesiredSize.Height > max)
|
||||||
|
max = labels[i].DesiredSize.Height;
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private double CalculateMaxLabelWidth()
|
||||||
|
{
|
||||||
|
if (labels != null)
|
||||||
|
{
|
||||||
|
double max = 0;
|
||||||
|
for (int i = 0; i < labels.Length; i++)
|
||||||
|
if (Children.Contains(labels[i]) && labels[i].DesiredSize.Width > max)
|
||||||
|
max = labels[i].DesiredSize.Width;
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private TickChange CheckLabelsArrangement(Size axisSize, IEnumerable<FrameworkElement> inputLabels, double[] inputTicks)
|
||||||
|
{
|
||||||
|
var actualLabels1 = inputLabels.Select((label, i) => new { Label = label, Index = i });
|
||||||
|
var actualLabels2 = actualLabels1.Where(el => el.Label != null);
|
||||||
|
var actualLabels3 = actualLabels2.Select(el => new { Label = el.Label, Tick = inputTicks[el.Index] });
|
||||||
|
var actualLabels = actualLabels3.ToList();
|
||||||
|
|
||||||
|
actualLabels.ForEach(item => item.Label.Measure(axisSize));
|
||||||
|
|
||||||
|
var sizeInfos = actualLabels.Select(item =>
|
||||||
|
new { Offset = GetCoordinateFromTick(item.Tick, axisSize), Size = IsHorizontal ? item.Label.DesiredSize.Width : item.Label.DesiredSize.Height })
|
||||||
|
.OrderBy(item => item.Offset).ToArray();
|
||||||
|
|
||||||
|
// If distance between labels if smaller than threshold for any of the labels - decrease
|
||||||
|
for (int i = 0; i < sizeInfos.Length - 1; i++)
|
||||||
|
if ((sizeInfos[i].Offset + sizeInfos[i].Size * decreaseRatio / 2) > sizeInfos[i + 1].Offset)
|
||||||
|
return TickChange.Decrease;
|
||||||
|
|
||||||
|
// If distance between labels if larger than threshold for all of the labels - increase
|
||||||
|
TickChange res = TickChange.Increase;
|
||||||
|
for (int i = 0; i < sizeInfos.Length - 1; i++)
|
||||||
|
{
|
||||||
|
if ((sizeInfos[i].Offset + sizeInfos[i].Size * increaseRatio / 2) > sizeInfos[i + 1].Offset)
|
||||||
|
{
|
||||||
|
res = TickChange.OK;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
private double GetCoordinateFromTick(double tick, Size screenSize)
|
||||||
|
{
|
||||||
|
return ValueToScreen(DataTransform.DataToPlot(tick), screenSize, Range);
|
||||||
|
}
|
||||||
|
|
||||||
|
private double ValueToScreen(double value, Size screenSize, Range range)
|
||||||
|
{
|
||||||
|
double leftBound, rightBound, topBound, bottomBound;
|
||||||
|
leftBound = bottomBound = IsReversed ? range.Max : range.Min;
|
||||||
|
rightBound = topBound = IsReversed ? range.Min : range.Max;
|
||||||
|
|
||||||
|
if (IsHorizontal)
|
||||||
|
{
|
||||||
|
return range.IsPoint ?
|
||||||
|
(screenSize.Width / 2) :
|
||||||
|
((value - leftBound) * screenSize.Width / (rightBound - leftBound));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return range.IsPoint ?
|
||||||
|
(screenSize.Height / 2) :
|
||||||
|
(screenSize.Height - (value - leftBound) * screenSize.Height / (rightBound - leftBound));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the value indcating whether the axis is horizontal or not.
|
||||||
|
/// </summary>
|
||||||
|
private bool IsHorizontal
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (AxisOrientation == AxisOrientation.Bottom || AxisOrientation == AxisOrientation.Top);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal enum TickChange
|
||||||
|
{
|
||||||
|
Increase = -1,
|
||||||
|
OK = 0,
|
||||||
|
Decrease = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
239
InteractiveDataDisplay_OneDll/src/Axes/AxisGrid.cs
Normal file
239
InteractiveDataDisplay_OneDll/src/Axes/AxisGrid.cs
Normal file
|
|
@ -0,0 +1,239 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Facilitates drawing of vertical and/or horizontal grid lines
|
||||||
|
/// </summary>
|
||||||
|
[Description("Grid of vertical and horizontal lines")]
|
||||||
|
public class AxisGrid : PlotBase
|
||||||
|
{
|
||||||
|
private Path path;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the <see cref="VerticalTicks"/> dependency property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty VerticalTicksProperty =
|
||||||
|
DependencyProperty.Register("VerticalTicks", typeof(IEnumerable<double>), typeof(AxisGrid), new PropertyMetadata(new double[0],
|
||||||
|
(o, e) =>
|
||||||
|
{
|
||||||
|
AxisGrid axisGrid = (AxisGrid)o;
|
||||||
|
if (axisGrid != null)
|
||||||
|
{
|
||||||
|
axisGrid.InvalidateMeasure();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the <see cref="HorizontalTicks"/> dependency property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty HorizontalTicksProperty =
|
||||||
|
DependencyProperty.Register("HorizontalTicks", typeof(IEnumerable<double>), typeof(AxisGrid), new PropertyMetadata(new double[0],
|
||||||
|
(o, e) =>
|
||||||
|
{
|
||||||
|
AxisGrid axisGrid = (AxisGrid)o;
|
||||||
|
if (axisGrid != null)
|
||||||
|
{
|
||||||
|
axisGrid.InvalidateMeasure();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the <see cref="Stroke"/> dependency property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty StrokeProperty =
|
||||||
|
DependencyProperty.Register("Stroke", typeof(SolidColorBrush), typeof(AxisGrid), new PropertyMetadata(new SolidColorBrush(Colors.LightGray),
|
||||||
|
(o, e) =>
|
||||||
|
{
|
||||||
|
AxisGrid axisGrid = (AxisGrid)o;
|
||||||
|
if (axisGrid != null)
|
||||||
|
{
|
||||||
|
axisGrid.InvalidateMeasure();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets collection for horizontal lines coordinates
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
[Description("Horizontal lines coordinates")]
|
||||||
|
public IEnumerable<double> VerticalTicks
|
||||||
|
{
|
||||||
|
get { return (IEnumerable<double>)GetValue(VerticalTicksProperty); }
|
||||||
|
set { SetValue(VerticalTicksProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets collection for vertical lines coordinates
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
[Description("Vertical lines coordinates")]
|
||||||
|
public IEnumerable<double> HorizontalTicks
|
||||||
|
{
|
||||||
|
get { return (IEnumerable<double>)GetValue(HorizontalTicksProperty); }
|
||||||
|
set { SetValue(HorizontalTicksProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies <see cref="IsXAxisReversed"/> dependency property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty IsXAxisReversedProperty =
|
||||||
|
DependencyProperty.Register("IsXAxisReversed", typeof(bool), typeof(AxisGrid), new PropertyMetadata(false));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a flag indicating whether the x-axis is reversed or not.
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public bool IsXAxisReversed
|
||||||
|
{
|
||||||
|
get { return (bool)GetValue(IsXAxisReversedProperty); }
|
||||||
|
set { SetValue(IsXAxisReversedProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies <see cref="IsYAxisReversed"/> dependency property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty IsYAxisReversedProperty =
|
||||||
|
DependencyProperty.Register("IsYAxisReversed", typeof(bool), typeof(AxisGrid), new PropertyMetadata(false));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a flag indicating whether the y-axis is reversed or not.
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public bool IsYAxisReversed
|
||||||
|
{
|
||||||
|
get { return (bool)GetValue(IsYAxisReversedProperty); }
|
||||||
|
set { SetValue(IsYAxisReversedProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Brush that specifies how the horizontal and vertical lines is painted
|
||||||
|
/// </summary>
|
||||||
|
[Category("Appearance")]
|
||||||
|
public SolidColorBrush Stroke
|
||||||
|
{
|
||||||
|
get { return (SolidColorBrush)GetValue(StrokeProperty); }
|
||||||
|
set { SetValue(StrokeProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes new instance of <see cref="AxisGrid"/> class
|
||||||
|
/// </summary>
|
||||||
|
public AxisGrid()
|
||||||
|
{
|
||||||
|
HorizontalTicks = new double[0];
|
||||||
|
VerticalTicks = new double[0];
|
||||||
|
|
||||||
|
path = new Path();
|
||||||
|
BindingOperations.SetBinding(path, Path.StrokeProperty, new Binding("Stroke") { Source = this, Mode = BindingMode.TwoWay });
|
||||||
|
path.StrokeThickness = 1.0;
|
||||||
|
Children.Add(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Measures the size in layout required for child elements and determines a size for the AxisGrid.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="availableSize">The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available.</param>
|
||||||
|
/// <returns>The size that this element determines it needs during layout, based on its calculations of child element sizes.</returns>
|
||||||
|
protected override Size MeasureOverride(Size availableSize)
|
||||||
|
{
|
||||||
|
if (Double.IsInfinity(availableSize.Width))
|
||||||
|
availableSize.Width = 1024;
|
||||||
|
if (Double.IsInfinity(availableSize.Height))
|
||||||
|
availableSize.Height = 1024;
|
||||||
|
|
||||||
|
|
||||||
|
GeometryGroup group = new GeometryGroup();
|
||||||
|
|
||||||
|
double[] hTicks = HorizontalTicks.ToArray();
|
||||||
|
double[] vTicks = VerticalTicks.ToArray();
|
||||||
|
|
||||||
|
if (hTicks != null && hTicks.Length > 0)
|
||||||
|
{
|
||||||
|
double minY = 0;
|
||||||
|
double maxY = availableSize.Height;
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
if (hTicks[0] < ActualPlotRect.X.Min) i++;
|
||||||
|
for (; i < hTicks.Length; i++)
|
||||||
|
{
|
||||||
|
double screenX = GetHorizontalCoordinateFromTick(hTicks[i], availableSize.Width, ActualPlotRect.X);
|
||||||
|
LineGeometry line = new LineGeometry();
|
||||||
|
line.StartPoint = new Point(screenX, minY);
|
||||||
|
line.EndPoint = new Point(screenX, maxY);
|
||||||
|
group.Children.Add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vTicks != null && vTicks.Length > 0)
|
||||||
|
{
|
||||||
|
double minX = 0;
|
||||||
|
double maxX = availableSize.Width;
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
if (vTicks[0] < ActualPlotRect.Y.Min) i++;
|
||||||
|
for (; i < vTicks.Length; i++)
|
||||||
|
{
|
||||||
|
double screenY = GetVerticalCoordinateFromTick(vTicks[i], availableSize.Height, ActualPlotRect.Y);
|
||||||
|
LineGeometry line = new LineGeometry();
|
||||||
|
line.StartPoint = new Point(minX, screenY);
|
||||||
|
line.EndPoint = new Point(maxX, screenY);
|
||||||
|
group.Children.Add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
path.Data = group;
|
||||||
|
|
||||||
|
foreach (UIElement child in Children)
|
||||||
|
{
|
||||||
|
child.Measure(availableSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return availableSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Positions child elements and determines a size for a AxisGrid
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="finalSize">The final area within the parent that AxisGrid should use to arrange itself and its children</param>
|
||||||
|
/// <returns>The actual size used</returns>
|
||||||
|
protected override Size ArrangeOverride(Size finalSize)
|
||||||
|
{
|
||||||
|
foreach (UIElement child in Children)
|
||||||
|
{
|
||||||
|
child.Arrange(new Rect(new Point(0, 0), finalSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
return finalSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
private double GetHorizontalCoordinateFromTick(double tick, double screenSize, Range range)
|
||||||
|
{
|
||||||
|
return ValueToScreen(XDataTransform.DataToPlot(tick), screenSize, range, IsXAxisReversed);
|
||||||
|
}
|
||||||
|
|
||||||
|
private double GetVerticalCoordinateFromTick(double tick, double screenSize, Range range)
|
||||||
|
{
|
||||||
|
return screenSize - ValueToScreen(YDataTransform.DataToPlot(tick), screenSize, range, IsYAxisReversed);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static double ValueToScreen(double value, double dimensionSize, Range range, bool isReversed)
|
||||||
|
{
|
||||||
|
var bound1 = isReversed ? range.Max : range.Min;
|
||||||
|
var bound2 = isReversed ? range.Min : range.Max;
|
||||||
|
return (value - bound1) * dimensionSize / (bound2 - bound1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
29
InteractiveDataDisplay_OneDll/src/Axes/AxisOrientation.cs
Normal file
29
InteractiveDataDisplay_OneDll/src/Axes/AxisOrientation.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright © Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies axes orientation.
|
||||||
|
/// </summary>
|
||||||
|
public enum AxisOrientation
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Axis will be vertical and ticks will be aligned to right.
|
||||||
|
/// </summary>
|
||||||
|
Left,
|
||||||
|
/// <summary>
|
||||||
|
/// Axis will be vertical and ticks will be aligned to left.
|
||||||
|
/// </summary>
|
||||||
|
Right,
|
||||||
|
/// <summary>
|
||||||
|
/// Axis will be horizontal and ticks will be aligned to bottom.
|
||||||
|
/// </summary>
|
||||||
|
Top,
|
||||||
|
/// <summary>
|
||||||
|
/// Axis will be horizontal and ticks will be aligned to top.
|
||||||
|
/// </summary>
|
||||||
|
Bottom
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
21
InteractiveDataDisplay_OneDll/src/Axes/ILabelProvider.cs
Normal file
21
InteractiveDataDisplay_OneDll/src/Axes/ILabelProvider.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
// Copyright © Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Defines a method to create labels as an array of <see cref="FrameworkElement"/> from an array of double values.
|
||||||
|
/// </summary>
|
||||||
|
public interface ILabelProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Generates an array of labels from an array of double.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ticks">An array of double ticks.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
FrameworkElement[] GetLabels(double[] ticks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
38
InteractiveDataDisplay_OneDll/src/Axes/LabelProvider.cs
Normal file
38
InteractiveDataDisplay_OneDll/src/Axes/LabelProvider.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
// Copyright © Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides mechanisms to generate labels displayed on an axis by double ticks.
|
||||||
|
/// </summary>
|
||||||
|
public class LabelProvider : ILabelProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Generates an array of labels from an array of double.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ticks">An array of double ticks.</param>
|
||||||
|
/// <returns>An array of <see cref="FrameworkElement"/>.</returns>
|
||||||
|
public FrameworkElement[] GetLabels(double[] ticks)
|
||||||
|
{
|
||||||
|
if (ticks == null)
|
||||||
|
throw new ArgumentNullException("ticks");
|
||||||
|
|
||||||
|
List<TextBlock> Labels = new List<TextBlock>();
|
||||||
|
foreach (double tick in ticks)
|
||||||
|
{
|
||||||
|
TextBlock text = new TextBlock();
|
||||||
|
text.Text = tick.ToString(CultureInfo.InvariantCulture);
|
||||||
|
Labels.Add(text);
|
||||||
|
}
|
||||||
|
return Labels.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
92
InteractiveDataDisplay_OneDll/src/Axes/MinorTicksProvider.cs
Normal file
92
InteractiveDataDisplay_OneDll/src/Axes/MinorTicksProvider.cs
Normal file
|
|
@ -0,0 +1,92 @@
|
||||||
|
// Copyright © Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides mechanisms to generate minor ticks displayed on an axis.
|
||||||
|
/// </summary>
|
||||||
|
public class MinorTicksProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Default ticks count for provider.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly int DefaultTicksCount = 3;
|
||||||
|
private int ticksCount;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="MinorTicksProvider"/> class with default ticks count.
|
||||||
|
/// </summary>
|
||||||
|
public MinorTicksProvider()
|
||||||
|
{
|
||||||
|
ticksCount = DefaultTicksCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the count of generated ticks.
|
||||||
|
/// </summary>
|
||||||
|
public int TicksCount
|
||||||
|
{
|
||||||
|
get { return ticksCount; }
|
||||||
|
set { ticksCount = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generates minor ticks for given array of major ticks and range.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="range">The range.</param>
|
||||||
|
/// <param name="ticks">An array of major ticks.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public double[] CreateTicks(Range range, double[] ticks)
|
||||||
|
{
|
||||||
|
if (ticks == null)
|
||||||
|
throw new ArgumentNullException("ticks");
|
||||||
|
|
||||||
|
if (ticks.Count() < 2)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
List<double> res = new List<double>();
|
||||||
|
double step = (ticks[1] - ticks[0]) / (ticksCount + 1);
|
||||||
|
int i = 1;
|
||||||
|
if (range.Min > ticks[0])
|
||||||
|
{
|
||||||
|
double x0 = ticks[1] - i * step;
|
||||||
|
res.Add(x0);
|
||||||
|
while (res[res.Count - 1] >= range.Min)
|
||||||
|
{
|
||||||
|
res.Add(x0 - i * step);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
int fin = ticks.Length - 1;
|
||||||
|
if (ticks[fin] > range.Max)
|
||||||
|
fin--;
|
||||||
|
for (i = 0; i < fin; i++)
|
||||||
|
{
|
||||||
|
double x0 = ticks[i] + step;
|
||||||
|
for (int j = 0; j < ticksCount; j++)
|
||||||
|
res.Add(x0 + j * step);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fin != ticks.Length - 1)
|
||||||
|
{
|
||||||
|
double x0 = ticks[fin] + step;
|
||||||
|
res.Add(x0);
|
||||||
|
i = 1;
|
||||||
|
while (res[res.Count - 1] <= range.Max)
|
||||||
|
{
|
||||||
|
res.Add(x0 + i * step);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
193
InteractiveDataDisplay_OneDll/src/Axes/PlotAxis.cs
Normal file
193
InteractiveDataDisplay_OneDll/src/Axes/PlotAxis.cs
Normal file
|
|
@ -0,0 +1,193 @@
|
||||||
|
// Copyright © Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
/// <summary>Facilitates drawing of vertical or horizontal coordinate axis connected to parent <see cref="Plot"/> element</summary>
|
||||||
|
[TemplatePart(Name = "PART_Axis", Type = typeof(Axis))]
|
||||||
|
[Description("Figure's axis")]
|
||||||
|
public sealed class PlotAxis : ContentControl
|
||||||
|
{
|
||||||
|
private PlotBase masterPlot = null;
|
||||||
|
private Axis axis;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes new instance of <see cref="PlotAxis"/> class
|
||||||
|
/// </summary>
|
||||||
|
public PlotAxis()
|
||||||
|
{
|
||||||
|
XDataTransform = new IdentityDataTransform();
|
||||||
|
YDataTransform = new IdentityDataTransform();
|
||||||
|
Ticks = new double[0];
|
||||||
|
DefaultStyleKey = typeof(PlotAxis);
|
||||||
|
Loaded += PlotAxisLoaded;
|
||||||
|
Unloaded += PlotAxisUnloaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PlotAxisUnloaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
masterPlot = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PlotAxisLoaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
masterPlot = PlotBase.FindMaster(this);
|
||||||
|
if (masterPlot != null)
|
||||||
|
InvalidateAxis();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Measures the size in layout required for child elements and determines a size for parent.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="availableSize">The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available.</param>
|
||||||
|
/// <returns>The size that this element determines it needs during layout, based on its calculations of child element sizes.</returns>
|
||||||
|
protected override Size MeasureOverride(Size availableSize)
|
||||||
|
{
|
||||||
|
InvalidateAxis();
|
||||||
|
return base.MeasureOverride(availableSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InvalidateAxis()
|
||||||
|
{
|
||||||
|
if (axis != null)
|
||||||
|
{
|
||||||
|
if (axis.AxisOrientation == AxisOrientation.Left ||
|
||||||
|
axis.AxisOrientation == AxisOrientation.Right)
|
||||||
|
{
|
||||||
|
if (masterPlot != null)
|
||||||
|
{
|
||||||
|
axis.Range = new Range(masterPlot.ActualPlotRect.YMin, masterPlot.ActualPlotRect.YMax);
|
||||||
|
}
|
||||||
|
axis.DataTransform = YDataTransform;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (masterPlot != null)
|
||||||
|
{
|
||||||
|
axis.Range = new Range(masterPlot.ActualPlotRect.XMin, masterPlot.ActualPlotRect.XMax);
|
||||||
|
}
|
||||||
|
axis.DataTransform = XDataTransform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked whenever application code or internal processes call ApplyTemplate
|
||||||
|
/// </summary>
|
||||||
|
public override void OnApplyTemplate()
|
||||||
|
{
|
||||||
|
base.OnApplyTemplate();
|
||||||
|
|
||||||
|
axis = GetTemplateChild("PART_Axis") as Axis;
|
||||||
|
if (axis == null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Invalid template!");
|
||||||
|
}
|
||||||
|
BindingOperations.SetBinding(this.axis, Axis.TicksProperty, new Binding("Ticks")
|
||||||
|
{
|
||||||
|
Source = this,
|
||||||
|
Mode = BindingMode.TwoWay
|
||||||
|
});
|
||||||
|
InvalidateAxis();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a set of double values displayed as axis ticks.
|
||||||
|
/// </summary>
|
||||||
|
[Browsable(false)]
|
||||||
|
public IEnumerable<double> Ticks
|
||||||
|
{
|
||||||
|
get { return (IEnumerable<double>)GetValue(TicksProperty); }
|
||||||
|
set { SetValue(TicksProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Identify <see cref="Ticks"/> property</summary>
|
||||||
|
public static readonly DependencyProperty TicksProperty =
|
||||||
|
DependencyProperty.Register("Ticks", typeof(IEnumerable<double>), typeof(PlotAxis), new PropertyMetadata(new double[0]));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets orientation of axis and location of labels
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
[Description("Defines orientation of axis and location of labels")]
|
||||||
|
public AxisOrientation AxisOrientation
|
||||||
|
{
|
||||||
|
get { return (AxisOrientation)GetValue(AxisOrientationProperty); }
|
||||||
|
set { SetValue(AxisOrientationProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Identify <see cref="AxisOrientation"/> property</summary>
|
||||||
|
public static readonly DependencyProperty AxisOrientationProperty =
|
||||||
|
DependencyProperty.Register("AxisOrientation", typeof(AxisOrientation), typeof(PlotAxis), new PropertyMetadata(AxisOrientation.Bottom));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a flag indicating whether the axis is reversed or not.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Axis is not reversed by default.</remarks>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
[Description("Defines orientation of axis and location of labels")]
|
||||||
|
public bool IsReversed
|
||||||
|
{
|
||||||
|
get { return (bool)GetValue(IsReversedProperty); }
|
||||||
|
set { SetValue(IsReversedProperty, value); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the <see cref="IsReversed"/> dependency property.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty IsReversedProperty =
|
||||||
|
DependencyProperty.Register("IsReversed", typeof(bool), typeof(PlotAxis), new PropertyMetadata(false));
|
||||||
|
|
||||||
|
/// <summary>Gets or sets transform from user data to horizontal plot coordinate.
|
||||||
|
/// By default transform is <see cref="IdentityDataTransform"/>
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public DataTransform XDataTransform
|
||||||
|
{
|
||||||
|
get { return (DataTransform)GetValue(XDataTransformProperty); }
|
||||||
|
set { SetValue(XDataTransformProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Gets or sets transform from user data to vertical plot coordinate.
|
||||||
|
/// By default transform is <see cref="IdentityDataTransform"/>
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public DataTransform YDataTransform
|
||||||
|
{
|
||||||
|
get { return (DataTransform)GetValue(YDataTransformProperty); }
|
||||||
|
set { SetValue(YDataTransformProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Identify <see cref="XDataTransform"/> property</summary>
|
||||||
|
public static readonly DependencyProperty XDataTransformProperty =
|
||||||
|
DependencyProperty.Register("XDataTransform", typeof(DataTransform), typeof(PlotAxis), new PropertyMetadata(null,
|
||||||
|
(o, e) =>
|
||||||
|
{
|
||||||
|
PlotAxis plot = o as PlotAxis;
|
||||||
|
if (plot != null)
|
||||||
|
{
|
||||||
|
plot.InvalidateAxis();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
/// <summary>Identify <see cref="YDataTransform"/> property</summary>
|
||||||
|
public static readonly DependencyProperty YDataTransformProperty =
|
||||||
|
DependencyProperty.Register("YDataTransform", typeof(DataTransform), typeof(PlotAxis), new PropertyMetadata(null,
|
||||||
|
(o, e) =>
|
||||||
|
{
|
||||||
|
PlotAxis plot = o as PlotAxis;
|
||||||
|
if (plot != null)
|
||||||
|
{
|
||||||
|
plot.InvalidateAxis();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
71
InteractiveDataDisplay_OneDll/src/Axes/RoundHelper.cs
Normal file
71
InteractiveDataDisplay_OneDll/src/Axes/RoundHelper.cs
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
// Copyright © Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
internal static class RoundHelper
|
||||||
|
{
|
||||||
|
//internal static int GetDifferenceLog(double min, double max)
|
||||||
|
//{
|
||||||
|
// return (int)Math.Log(Math.Abs(max - min));
|
||||||
|
//}
|
||||||
|
|
||||||
|
internal static double Floor(double number, int rem)
|
||||||
|
{
|
||||||
|
if (rem <= 0)
|
||||||
|
{
|
||||||
|
rem = MathHelper.Clamp(-rem, 0, 15);
|
||||||
|
}
|
||||||
|
double pow = Math.Pow(10, rem - 1);
|
||||||
|
double val = pow * Math.Floor((double)(number / Math.Pow(10, rem - 1)));
|
||||||
|
return val;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static double Round(double number, int rem)
|
||||||
|
{
|
||||||
|
if (rem <= 0)
|
||||||
|
{
|
||||||
|
rem = MathHelper.Clamp(-rem, 0, 15);
|
||||||
|
return Math.Round(number, rem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double pow = Math.Pow(10, rem - 1);
|
||||||
|
double val = pow * Math.Round(number / Math.Pow(10, rem - 1));
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//internal static RoundingInfo CreateRoundedRange(double min, double max)
|
||||||
|
//{
|
||||||
|
// double delta = max - min;
|
||||||
|
|
||||||
|
// if (delta == 0)
|
||||||
|
// return new RoundingInfo { Min = min, Max = max, Log = 0 };
|
||||||
|
|
||||||
|
// int log = (int)Math.Round(Math.Log10(Math.Abs(delta))) + 1;
|
||||||
|
|
||||||
|
// double newMin = Round(min, log);
|
||||||
|
// double newMax = Round(max, log);
|
||||||
|
// if (newMin == newMax)
|
||||||
|
// {
|
||||||
|
// log--;
|
||||||
|
// newMin = Round(min, log);
|
||||||
|
// newMax = Round(max, log);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return new RoundingInfo { Min = newMin, Max = newMax, Log = log };
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
//[DebuggerDisplay("{Min} - {Max}, Log = {Log}")]
|
||||||
|
//internal sealed class RoundingInfo
|
||||||
|
//{
|
||||||
|
// public double Min { get; set; }
|
||||||
|
// public double Max { get; set; }
|
||||||
|
// public int Log { get; set; }
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
132
InteractiveDataDisplay_OneDll/src/Axes/TicksProvider.cs
Normal file
132
InteractiveDataDisplay_OneDll/src/Axes/TicksProvider.cs
Normal file
|
|
@ -0,0 +1,132 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides mechanisms to generate ticks displayed on an axis.
|
||||||
|
/// </summary>
|
||||||
|
public class TicksProvider
|
||||||
|
{
|
||||||
|
private int delta = 1;
|
||||||
|
private int beta = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="TicksProvider"/> class with default <see cref="MinorTicksProvider"/>.
|
||||||
|
/// </summary>
|
||||||
|
public TicksProvider()
|
||||||
|
{
|
||||||
|
minorProvider = new MinorTicksProvider();
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly MinorTicksProvider minorProvider;
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the <see cref="MinorTicksProvider"/>.
|
||||||
|
/// </summary>
|
||||||
|
public MinorTicksProvider MinorProvider
|
||||||
|
{
|
||||||
|
get { return minorProvider; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private Range range = new Range(0, 1);
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the range of axis.
|
||||||
|
/// </summary>
|
||||||
|
public Range Range
|
||||||
|
{
|
||||||
|
get { return range; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
range = value;
|
||||||
|
delta = 1;
|
||||||
|
beta = (int)Math.Round(Math.Log10(range.Max - range.Min)) - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets an array of ticks for specified axis range.
|
||||||
|
/// </summary>
|
||||||
|
public double[] GetTicks()
|
||||||
|
{
|
||||||
|
double start = Range.Min;
|
||||||
|
double finish = Range.Max;
|
||||||
|
double d = finish - start;
|
||||||
|
|
||||||
|
if (d == 0)
|
||||||
|
return new double[] { start, finish };
|
||||||
|
|
||||||
|
double temp = delta * Math.Pow(10, beta);
|
||||||
|
double min = Math.Floor(start / temp);
|
||||||
|
double max = Math.Floor(finish / temp);
|
||||||
|
int count = (int)(max - min + 1);
|
||||||
|
List<double> res = new List<double>();
|
||||||
|
double x0 = min * temp;
|
||||||
|
for (int i = 0; i < count + 1; i++)
|
||||||
|
{
|
||||||
|
double v = RoundHelper.Round(x0 + i * temp, beta);
|
||||||
|
if(v >= start && v <= finish)
|
||||||
|
res.Add(v);
|
||||||
|
}
|
||||||
|
return res.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Decreases the tick count.
|
||||||
|
/// </summary>
|
||||||
|
public void DecreaseTickCount()
|
||||||
|
{
|
||||||
|
if (delta == 1)
|
||||||
|
{
|
||||||
|
delta = 2;
|
||||||
|
}
|
||||||
|
else if (delta == 2)
|
||||||
|
{
|
||||||
|
delta = 5;
|
||||||
|
}
|
||||||
|
else if (delta == 5)
|
||||||
|
{
|
||||||
|
delta = 1;
|
||||||
|
beta++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Increases the tick count.
|
||||||
|
/// </summary>
|
||||||
|
public void IncreaseTickCount()
|
||||||
|
{
|
||||||
|
if (delta == 1)
|
||||||
|
{
|
||||||
|
delta = 5;
|
||||||
|
beta--;
|
||||||
|
}
|
||||||
|
else if (delta == 2)
|
||||||
|
{
|
||||||
|
delta = 1;
|
||||||
|
}
|
||||||
|
else if (delta == 5)
|
||||||
|
{
|
||||||
|
delta = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generates minor ticks in specified range.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="range">The range.</param>
|
||||||
|
/// <returns>An array of minor ticks.</returns>
|
||||||
|
public double[] GetMinorTicks(Range range)
|
||||||
|
{
|
||||||
|
var ticks = new List<double>(GetTicks());
|
||||||
|
double temp = delta * Math.Pow(10, beta);
|
||||||
|
ticks.Insert(0, RoundHelper.Round(ticks[0] - temp, beta));
|
||||||
|
ticks.Add(RoundHelper.Round(ticks[ticks.Count - 1] + temp, beta));
|
||||||
|
return minorProvider.CreateTicks(range, ticks.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
332
InteractiveDataDisplay_OneDll/src/Chart.cs
Normal file
332
InteractiveDataDisplay_OneDll/src/Chart.cs
Normal file
|
|
@ -0,0 +1,332 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Markup;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Ready to use figure with left and bottom axes, grid, legend, mouse and keyboard navigation
|
||||||
|
/// </summary>
|
||||||
|
[ContentProperty("Content")]
|
||||||
|
[Description("Ready to use figure")]
|
||||||
|
public class Chart : ContentControl
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="Chart"/> class.
|
||||||
|
/// </summary>
|
||||||
|
public Chart()
|
||||||
|
{
|
||||||
|
DefaultStyleKey = typeof(Chart);
|
||||||
|
Background = new SolidColorBrush(Colors.White);
|
||||||
|
Foreground = new SolidColorBrush(Colors.Black);
|
||||||
|
LegendContent = new LegendItemsPanel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnApplyTemplate()
|
||||||
|
{
|
||||||
|
base.OnApplyTemplate();
|
||||||
|
PlotAxis plotAxis = base.GetTemplateChild("PART_horizontalAxis") as PlotAxis;
|
||||||
|
PlotAxis plotAxis2 = base.GetTemplateChild("PART_verticalAxis") as PlotAxis;
|
||||||
|
AxisGrid axisGrid = base.GetTemplateChild("PART_axisGrid") as AxisGrid;
|
||||||
|
if (plotAxis == null || plotAxis2 == null || axisGrid == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BindingOperations.SetBinding(axisGrid, AxisGrid.HorizontalTicksProperty, new Binding("Ticks")
|
||||||
|
{
|
||||||
|
Source = plotAxis
|
||||||
|
});
|
||||||
|
BindingOperations.SetBinding(axisGrid, AxisGrid.VerticalTicksProperty, new Binding("Ticks")
|
||||||
|
{
|
||||||
|
Source = plotAxis2
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Raises the GotFocus event.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e">An EventArgs that contains the event data.</param>
|
||||||
|
protected override void OnGotFocus(RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
VisualStateManager.GoToState(this, "Focused", false);
|
||||||
|
base.OnGotFocus(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raises the LostFocus event.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e">An EventArgs that contains the event data.</param>
|
||||||
|
protected override void OnLostFocus(RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
VisualStateManager.GoToState(this, "Unfocused", false);
|
||||||
|
base.OnLostFocus(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets legend content
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public object LegendContent
|
||||||
|
{
|
||||||
|
get { return (object)GetValue(LegendContentProperty); }
|
||||||
|
set { SetValue(LegendContentProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies <see cref="LegendContent"/> dependency property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty LegendContentProperty =
|
||||||
|
DependencyProperty.Register("LegendContent", typeof(object), typeof(Chart), new PropertyMetadata(null));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets visibility of LegendControl
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public Visibility LegendVisibility
|
||||||
|
{
|
||||||
|
get { return (Visibility)GetValue(LegendVisibilityProperty); }
|
||||||
|
set { SetValue(LegendVisibilityProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies <see cref="LegendVisibility"/> dependency property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty LegendVisibilityProperty =
|
||||||
|
DependencyProperty.Register("LegendVisibility", typeof(Visibility), typeof(Chart), new PropertyMetadata(Visibility.Visible));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets auto fit mode. <see cref="IsAutoFitEnabled"/> property of all
|
||||||
|
/// plots in compositions are updated instantly to have same value.
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public bool IsAutoFitEnabled
|
||||||
|
{
|
||||||
|
get { return (bool)GetValue(IsAutoFitEnabledProperty); }
|
||||||
|
set { SetValue(IsAutoFitEnabledProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies <see cref="IsAutoFitEnabled"/> dependency property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty IsAutoFitEnabledProperty =
|
||||||
|
DependencyProperty.Register("IsAutoFitEnabled", typeof(bool), typeof(Chart), new PropertyMetadata(true));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets desired plot width in plot coordinates. Settings this property
|
||||||
|
/// turns off auto fit mode.
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public double PlotWidth
|
||||||
|
{
|
||||||
|
get { return (double)GetValue(PlotWidthProperty); }
|
||||||
|
set { SetValue(PlotWidthProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies <see cref="PlotWidth"/> dependency property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty PlotWidthProperty =
|
||||||
|
DependencyProperty.Register("PlotWidth", typeof(double), typeof(Chart), new PropertyMetadata(1.0));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets desired plot height in plot coordinates. Settings this property
|
||||||
|
/// turns off auto fit mode.
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public double PlotHeight
|
||||||
|
{
|
||||||
|
get { return (double)GetValue(PlotHeightProperty); }
|
||||||
|
set { SetValue(PlotHeightProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies <see cref="PlotHeight"/> dependency property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty PlotHeightProperty =
|
||||||
|
DependencyProperty.Register("PlotHeight", typeof(double), typeof(Chart), new PropertyMetadata(1.0));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets desired minimal visible horizontal coordinate in plot coordinates. Settings this property
|
||||||
|
/// turns off auto fit mode.
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public double PlotOriginX
|
||||||
|
{
|
||||||
|
get { return (double)GetValue(PlotOriginXProperty); }
|
||||||
|
set { SetValue(PlotOriginXProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies <see cref="PlotOriginX"/> dependency property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty PlotOriginXProperty =
|
||||||
|
DependencyProperty.Register("PlotOriginX", typeof(double), typeof(Chart), new PropertyMetadata(0.0));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets desired minimal visible vertical coordinate in plot coordinates. Settings this property
|
||||||
|
/// turns off auto fit mode.
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public double PlotOriginY
|
||||||
|
{
|
||||||
|
get { return (double)GetValue(PlotOriginYProperty); }
|
||||||
|
set { SetValue(PlotOriginYProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies <see cref="PlotOriginY"/> dependency property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty PlotOriginYProperty =
|
||||||
|
DependencyProperty.Register("PlotOriginY", typeof(double), typeof(Chart), new PropertyMetadata(0.0));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desired ratio of horizontal scale to vertical scale. Values less than or equal to zero
|
||||||
|
/// represent unspecified aspect ratio.
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public double AspectRatio
|
||||||
|
{
|
||||||
|
get { return (double)GetValue(AspectRatioProperty); }
|
||||||
|
set { SetValue(AspectRatioProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies <see cref="AspectRatio"/> dependency property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty AspectRatioProperty =
|
||||||
|
DependencyProperty.Register("AspectRatio", typeof(double), typeof(Chart), new PropertyMetadata(0.0));
|
||||||
|
|
||||||
|
/// <summary>Gets or sets chart title. Chart title is an object that is shown centered above plot area.
|
||||||
|
/// Chart title is used inside <see cref="System.Windows.Controls.ContentControl"/> and can be a
|
||||||
|
/// <see cref="System.Windows.UIElement"/>.</summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public object Title
|
||||||
|
{
|
||||||
|
get { return (object)GetValue(TitleProperty); }
|
||||||
|
set { SetValue(TitleProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Identifies <see cref="Title"/> dependency property</summary>
|
||||||
|
public static readonly DependencyProperty TitleProperty =
|
||||||
|
DependencyProperty.Register("Title", typeof(object), typeof(Chart), new PropertyMetadata(null));
|
||||||
|
|
||||||
|
/// <summary>Gets or sets bottom axis title. Bottom axis title is an object that is centered under plot area.
|
||||||
|
/// Bottom axis title is used inside <see cref="System.Windows.Controls.ContentControl"/> and can be a
|
||||||
|
/// <see cref="System.Windows.UIElement"/>.</summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public object BottomTitle
|
||||||
|
{
|
||||||
|
get { return (object)GetValue(BottomTitleProperty); }
|
||||||
|
set { SetValue(BottomTitleProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Identifies <see cref="BottomTitle"/> dependency property</summary>
|
||||||
|
public static readonly DependencyProperty BottomTitleProperty =
|
||||||
|
DependencyProperty.Register("BottomTitle", typeof(object), typeof(Chart), new PropertyMetadata(null));
|
||||||
|
|
||||||
|
/// <summary>Gets or sets right axis title. Right axis title is an object that is vertically centered
|
||||||
|
/// and located to the right from plot area.
|
||||||
|
/// Right axis title is used inside <see cref="System.Windows.Controls.ContentControl"/> and can be a
|
||||||
|
/// <see cref="System.Windows.UIElement"/>.</summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public object RightTitle
|
||||||
|
{
|
||||||
|
get { return (object)GetValue(RightTitleProperty); }
|
||||||
|
set { SetValue(RightTitleProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Identifies <see cref="RightTitle"/> dependency property</summary>
|
||||||
|
public static readonly DependencyProperty RightTitleProperty =
|
||||||
|
DependencyProperty.Register("RightTitle", typeof(object), typeof(Chart), new PropertyMetadata(null));
|
||||||
|
|
||||||
|
/// <summary>Gets or sets left axis title. Left axis title is an object that is vertically centered
|
||||||
|
/// and located to the left from plot area.
|
||||||
|
/// Left axis title is used inside <see cref="System.Windows.Controls.ContentControl"/> and can be a
|
||||||
|
/// <see cref="System.Windows.UIElement"/>.</summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public object LeftTitle
|
||||||
|
{
|
||||||
|
get { return (object)GetValue(LeftTitleProperty); }
|
||||||
|
set { SetValue(LeftTitleProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Identifies <see cref="LeftTitle"/> dependency property</summary>
|
||||||
|
public static readonly DependencyProperty LeftTitleProperty =
|
||||||
|
DependencyProperty.Register("LeftTitle", typeof(object), typeof(Chart), new PropertyMetadata(null));
|
||||||
|
|
||||||
|
/// <summary>Gets or sets thickness of border surrounding Chart center. This value also is taken into
|
||||||
|
/// account when computing screen padding</summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public new Thickness BorderThickness
|
||||||
|
{
|
||||||
|
get { return (Thickness)GetValue(BorderThicknessProperty); }
|
||||||
|
set { SetValue(BorderThicknessProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Identifies <see cref="BorderThickness"/> property</summary>
|
||||||
|
public static new readonly DependencyProperty BorderThicknessProperty =
|
||||||
|
DependencyProperty.Register("BorderThickness", typeof(Thickness), typeof(Chart), new PropertyMetadata(new Thickness(1)));
|
||||||
|
|
||||||
|
/// <summary>Gets or sets vertical navigation status. True means that user can navigate along Y axis</summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public bool IsVerticalNavigationEnabled
|
||||||
|
{
|
||||||
|
get { return (bool)GetValue(IsVerticalNavigationEnabledProperty); }
|
||||||
|
set { SetValue(IsVerticalNavigationEnabledProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Identifies <see cref="IsVerticalNavigationEnabled"/> property</summary>
|
||||||
|
public static readonly DependencyProperty IsVerticalNavigationEnabledProperty =
|
||||||
|
DependencyProperty.Register("IsVerticalNavigationEnabled", typeof(bool), typeof(Chart), new PropertyMetadata(true));
|
||||||
|
|
||||||
|
/// <summary>Gets or sets horizontal navigation status. True means that user can navigate along X axis</summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public bool IsHorizontalNavigationEnabled
|
||||||
|
{
|
||||||
|
get { return (bool)GetValue(IsHorizontalNavigationEnabledProperty); }
|
||||||
|
set { SetValue(IsHorizontalNavigationEnabledProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Identifies <see cref="IsHorizontalNavigationEnabled"/> property</summary>
|
||||||
|
public static readonly DependencyProperty IsHorizontalNavigationEnabledProperty =
|
||||||
|
DependencyProperty.Register("IsHorizontalNavigationEnabled", typeof(bool), typeof(Chart), new PropertyMetadata(true));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies <see cref="IsXAxisReversed"/> dependency property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty IsXAxisReversedProperty =
|
||||||
|
DependencyProperty.Register("IsXAxisReversed", typeof(bool), typeof(Chart), new PropertyMetadata(false));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a flag indicating whether the x-axis is reversed or not.
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public bool IsXAxisReversed
|
||||||
|
{
|
||||||
|
get { return (bool)GetValue(IsXAxisReversedProperty); }
|
||||||
|
set { SetValue(IsXAxisReversedProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies <see cref="IsYAxisReversed"/> dependency property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty IsYAxisReversedProperty =
|
||||||
|
DependencyProperty.Register("IsYAxisReversed", typeof(bool), typeof(Chart), new PropertyMetadata(false));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a flag indicating whether the y-axis is reversed or not.
|
||||||
|
/// </summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public bool IsYAxisReversed
|
||||||
|
{
|
||||||
|
get { return (bool)GetValue(IsYAxisReversedProperty); }
|
||||||
|
set { SetValue(IsYAxisReversedProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
176
InteractiveDataDisplay_OneDll/src/Common/ArrayHelper.cs
Normal file
176
InteractiveDataDisplay_OneDll/src/Common/ArrayHelper.cs
Normal file
|
|
@ -0,0 +1,176 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Helper class for performing manipulations with arrays
|
||||||
|
/// </summary>
|
||||||
|
public static class ArrayExtensions
|
||||||
|
{
|
||||||
|
/// <summary>Gets index of item that is nearest to <paramref name="value"/>.</summary>
|
||||||
|
/// <param name="array">Array in ascending order.</param>
|
||||||
|
/// <param name="value">Value to look for.</param>
|
||||||
|
/// <returns>Index of closest element or -1 if <paramref name="value"/>
|
||||||
|
/// is less than first element or greater than last.</returns>
|
||||||
|
public static int GetNearestIndex(double[] array, double value)
|
||||||
|
{
|
||||||
|
if (array == null)
|
||||||
|
throw new ArgumentNullException("array");
|
||||||
|
int i = Array.BinarySearch<double>(array, value);
|
||||||
|
if (i >= 0)
|
||||||
|
return i;
|
||||||
|
i = ~i;
|
||||||
|
if (i == array.Length)
|
||||||
|
return -1; // greater than last value
|
||||||
|
if (i == 0)
|
||||||
|
return -1; // less than first value
|
||||||
|
return (value - array[i - 1] > array[i] - value) ? (i) : (i - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 1D array conversion utils
|
||||||
|
|
||||||
|
/// <summary>Converts array of floats to array of doubles</summary>
|
||||||
|
/// <param name="array">Array of float</param>
|
||||||
|
/// <returns>Array of same length but with double elements</returns>
|
||||||
|
public static double[] ToDoubleArray(this float[] array)
|
||||||
|
{
|
||||||
|
if (array == null)
|
||||||
|
throw new ArgumentNullException("array");
|
||||||
|
double[] result = new double[array.Length];
|
||||||
|
for (int i = 0; i < array.Length; i++)
|
||||||
|
result[i] = array[i];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Converts array of 32-bit integers to array of doubles</summary>
|
||||||
|
/// <param name="array">Array of 32-bit integers</param>
|
||||||
|
/// <returns>Array of same length but with double elements</returns>
|
||||||
|
public static double[] ToDoubleArray(this int[] array)
|
||||||
|
{
|
||||||
|
if (array == null)
|
||||||
|
throw new ArgumentNullException("array");
|
||||||
|
double[] result = new double[array.Length];
|
||||||
|
for (int i = 0; i < array.Length; i++)
|
||||||
|
result[i] = array[i];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Converts array of booleans to array of doubles where true maps to 1, false maps to 0</summary>
|
||||||
|
/// <param name="array">Array of booleans</param>
|
||||||
|
/// <returns>Array of same dimensions but with double elements</returns>
|
||||||
|
public static double[] ToDoubleArray(this bool[] array)
|
||||||
|
{
|
||||||
|
if (array == null)
|
||||||
|
throw new ArgumentNullException("array");
|
||||||
|
double[] result = new double[array.Length];
|
||||||
|
for (int i = 0; i < array.Length; i++)
|
||||||
|
result[i] = array[i] ? 1 : 0 ;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Converts array of doubles, floats, integers or booleans to array of doubles where true maps to 1, false maps to 0</summary>
|
||||||
|
/// <param name="array">Source array</param>
|
||||||
|
/// <returns>Array of same length but with double elements</returns>
|
||||||
|
public static double[] ToDoubleArray(Array array)
|
||||||
|
{
|
||||||
|
if (array == null)
|
||||||
|
throw new ArgumentNullException("array");
|
||||||
|
if (array.Rank != 1)
|
||||||
|
throw new InvalidOperationException("Source array is not 1D");
|
||||||
|
var elemType = array.GetType().GetElementType();
|
||||||
|
if (elemType == typeof(double))
|
||||||
|
return (double[])array;
|
||||||
|
if (elemType == typeof(float))
|
||||||
|
return ArrayExtensions.ToDoubleArray((float[])array);
|
||||||
|
else if (elemType == typeof(int))
|
||||||
|
return ArrayExtensions.ToDoubleArray((int[])array);
|
||||||
|
else if (elemType == typeof(bool))
|
||||||
|
return ArrayExtensions.ToDoubleArray((bool[])array);
|
||||||
|
else
|
||||||
|
throw new NotSupportedException("Conversions of 1D arrays of " + elemType.Name + " to double[] is not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 2D array conversion utils
|
||||||
|
|
||||||
|
/// <summary>Converts 2D array of floats to 2D array of doubles</summary>
|
||||||
|
/// <param name="array">2D array of float</param>
|
||||||
|
/// <returns>2D array of same dimensions but with double elements</returns>
|
||||||
|
[CLSCompliantAttribute(false)]
|
||||||
|
public static double[,] ToDoubleArray(this float[,] array)
|
||||||
|
{
|
||||||
|
if (array == null)
|
||||||
|
throw new ArgumentNullException("array");
|
||||||
|
int n = array.GetLength(0);
|
||||||
|
int m = array.GetLength(1);
|
||||||
|
double[,] result = new double[n, m];
|
||||||
|
for (int i = 0; i < n; i++)
|
||||||
|
for (int j = 0; j < m; j++)
|
||||||
|
result[i, j] = array[i, j];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Converts 2D array of 32-bit integers to 2D array of doubles</summary>
|
||||||
|
/// <param name="array">2D array of 32-bit integers</param>
|
||||||
|
/// <returns>2D array of same dimensions but with double elements</returns>
|
||||||
|
[CLSCompliantAttribute(false)]
|
||||||
|
public static double[,] ToDoubleArray(this int[,] array)
|
||||||
|
{
|
||||||
|
if (array == null)
|
||||||
|
throw new ArgumentNullException("array");
|
||||||
|
int n = array.GetLength(0);
|
||||||
|
int m = array.GetLength(1);
|
||||||
|
double[,] result = new double[n, m];
|
||||||
|
for (int i = 0; i < n; i++)
|
||||||
|
for (int j = 0; j < m; j++)
|
||||||
|
result[i, j] = array[i, j];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Converts 2D array of booleans to 2D array of doubles where true maps to 1, false maps to 0</summary>
|
||||||
|
/// <param name="array">2D array of booleans</param>
|
||||||
|
/// <returns>2D array of same dimensions but with double elements</returns>
|
||||||
|
[CLSCompliantAttribute(false)]
|
||||||
|
public static double[,] ToDoubleArray(this bool[,] array)
|
||||||
|
{
|
||||||
|
if (array == null)
|
||||||
|
throw new ArgumentNullException("array");
|
||||||
|
int n = array.GetLength(0);
|
||||||
|
int m = array.GetLength(1);
|
||||||
|
double[,] result = new double[n, m];
|
||||||
|
for (int i = 0; i < n; i++)
|
||||||
|
for (int j = 0; j < m; j++)
|
||||||
|
result[i, j] = array[i, j] ? 1 : 0;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Converts 2D array of doubles, floats, integers or booleans to 2D array of doubles where true maps to 1, false maps to 0</summary>
|
||||||
|
/// <param name="array">2D array</param>
|
||||||
|
/// <returns>2D array of same dimensions but with double elements</returns>
|
||||||
|
public static double[,] ToDoubleArray2D(Array array)
|
||||||
|
{
|
||||||
|
if (array == null)
|
||||||
|
throw new ArgumentNullException("array");
|
||||||
|
if (array.Rank != 2)
|
||||||
|
throw new InvalidOperationException("Source array is not 2D");
|
||||||
|
var elemType = array.GetType().GetElementType();
|
||||||
|
if (elemType == typeof(double))
|
||||||
|
return (double[,])array;
|
||||||
|
if (elemType == typeof(float))
|
||||||
|
return ArrayExtensions.ToDoubleArray((float[,])array);
|
||||||
|
else if (elemType == typeof(int))
|
||||||
|
return ArrayExtensions.ToDoubleArray((int[,])array);
|
||||||
|
else if (elemType == typeof(bool))
|
||||||
|
return ArrayExtensions.ToDoubleArray((bool[,])array);
|
||||||
|
else
|
||||||
|
throw new NotSupportedException("Conversions of 2D arrays of " + elemType.Name + " to double[,] is not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
232
InteractiveDataDisplay_OneDll/src/Common/DataRect.cs
Normal file
232
InteractiveDataDisplay_OneDll/src/Common/DataRect.cs
Normal file
|
|
@ -0,0 +1,232 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Describes a width, a height and location of a rectangle.
|
||||||
|
/// This type is very similar to <see cref="System.Windows.Rect"/>, but has one important difference:
|
||||||
|
/// while <see cref="System.Windows.Rect"/> describes a rectangle in screen coordinates, where y axis
|
||||||
|
/// points to bottom (that's why <see cref="System.Windows.Rect"/>'s Bottom property is greater than Top).
|
||||||
|
/// This type describes rectange in usual coordinates, and y axis point to top.
|
||||||
|
/// </summary>
|
||||||
|
public struct DataRect
|
||||||
|
{
|
||||||
|
private Range x;
|
||||||
|
private Range y;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the empty <see cref="DataRect"/>.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DataRect Empty =
|
||||||
|
new DataRect(Range.Empty, Range.Empty);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="DataRect"/> struct.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="minX">Left value of DataRect.</param>
|
||||||
|
/// <param name="minY">Bottom value of DataRect.</param>
|
||||||
|
/// <param name="maxX">Right value of DataRect.</param>
|
||||||
|
/// <param name="maxY">Top value of DataRect.</param>
|
||||||
|
public DataRect(double minX, double minY, double maxX, double maxY)
|
||||||
|
: this()
|
||||||
|
{
|
||||||
|
X = new Range(minX, maxX);
|
||||||
|
Y = new Range(minY, maxY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="DataRect"/> struct.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="horizontal">Horizontal range</param>
|
||||||
|
/// <param name="vertical">Vertical range</param>
|
||||||
|
public DataRect(Range horizontal, Range vertical)
|
||||||
|
: this()
|
||||||
|
{
|
||||||
|
X = horizontal; Y = vertical;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets of Sets horizontal range
|
||||||
|
/// </summary>
|
||||||
|
public Range X
|
||||||
|
{
|
||||||
|
get { return x; }
|
||||||
|
set { x = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets vertical range
|
||||||
|
/// </summary>
|
||||||
|
public Range Y
|
||||||
|
{
|
||||||
|
get { return y; }
|
||||||
|
set { y = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the width of <see cref="DataRect"/>.
|
||||||
|
/// </summary>
|
||||||
|
public double Width
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return X.Max - X.Min;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the height of <see cref="DataRect"/>.
|
||||||
|
/// </summary>
|
||||||
|
public double Height
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Y.Max - Y.Min;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the left.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The left.</value>
|
||||||
|
public double XMin
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return X.Min;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the right.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The right.</value>
|
||||||
|
public double XMax
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return X.Max;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the bottom.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The bottom.</value>
|
||||||
|
public double YMin
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Y.Min;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the top.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The top.</value>
|
||||||
|
public double YMax
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Y.Max;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a center point of a rectangle.
|
||||||
|
/// </summary>
|
||||||
|
public Point Center
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new Point((X.Max + X.Min) / 2.0, (Y.Max + Y.Min) / 2.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether this instance is empty.
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if this instance is empty; otherwise, <c>false</c>.</value>
|
||||||
|
public bool IsEmpty
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return X.IsEmpty || Y.IsEmpty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates current instance of <see cref="DataRect"/> with minimal DataRect
|
||||||
|
/// which vertical range will contain current vertical range and x value and
|
||||||
|
/// horizontal range will contain current horizontal range and y value
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">Value, which will be used for surrond of horizontal range</param>
|
||||||
|
/// <param name="y">Value, which will be used for surrond of vertical range</param>
|
||||||
|
public void Surround(double x, double y)
|
||||||
|
{
|
||||||
|
this.x.Surround(x);
|
||||||
|
this.y.Surround(y);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates current instance of <see cref="DataRect"/> with minimal DataRect which will contain current DataRect and specified DataRect
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="rect">DataRect, which will be used for surrond of current instance of <see cref="DataRect"/></param>
|
||||||
|
public void Surround(DataRect rect)
|
||||||
|
{
|
||||||
|
this.x.Surround(rect.X);
|
||||||
|
this.y.Surround(rect.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates horizontal range of current instance of <see cref="DataRect"/> with minimal range which will contain both horizontal range of current DataRect and specified value
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">Value, which will be used for surrond of horizontal range of current instance of <see cref="DataRect"/></param>
|
||||||
|
public void XSurround(double x)
|
||||||
|
{
|
||||||
|
this.x.Surround(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates horizontal range of current instance of <see cref="DataRect"/> with minimal range which will contain both horizontal range of current DataRect and specified range
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">Range, which will be used for surrond of horizontal range of current instance of <see cref="DataRect"/></param>
|
||||||
|
public void XSurround(Range x)
|
||||||
|
{
|
||||||
|
this.x.Surround(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates vertical range of current instance of <see cref="DataRect"/> with minimal range which will contain both vertical range of current DataRect and specified value
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="y">Value, which will be used for surrond of vertical range of current instance of <see cref="DataRect"/></param>
|
||||||
|
public void YSurround(double y)
|
||||||
|
{
|
||||||
|
this.y.Surround(y);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates vertical range of current instance of <see cref="DataRect"/> with minimal range which will contain both vertical range of current DataRect and specified range
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="y">Range, which will be used for surrond of vertical range of current instance of <see cref="DataRect"/></param>
|
||||||
|
public void YSurround(Range y)
|
||||||
|
{
|
||||||
|
this.y.Surround(y);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string that represents the current instance of <see cref="DataRect"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>String that represents the current instance of <see cref="DataRect"/></returns>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return "{" + X.ToString() + " " + Y.ToString() + "}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
35
InteractiveDataDisplay_OneDll/src/Common/IPalette.cs
Normal file
35
InteractiveDataDisplay_OneDll/src/Common/IPalette.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
// Copyright © 2010 Microsoft Corporation, All Rights Reserved.
|
||||||
|
// This code released under the terms of the Microsoft Research License Agreement (MSR-LA, http://sds.codeplex.com/License)
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a color palette, which can convert double values to colors.
|
||||||
|
/// </summary>
|
||||||
|
public interface IPalette
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a color for the specified value.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">A value from the <see cref="Range"/>.</param>
|
||||||
|
/// <returns>A color.</returns>
|
||||||
|
Color GetColor(double value);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the value indicating whether the <see cref="Range"/> contains absolute values
|
||||||
|
/// or it is relative ([0...1]).
|
||||||
|
/// </summary>
|
||||||
|
bool IsNormalized { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the range on which palette is defined.
|
||||||
|
/// </summary>
|
||||||
|
Range Range { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
103
InteractiveDataDisplay_OneDll/src/Common/MathHelper.cs
Normal file
103
InteractiveDataDisplay_OneDll/src/Common/MathHelper.cs
Normal file
|
|
@ -0,0 +1,103 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Helper class for mathematical calculations.
|
||||||
|
/// </summary>
|
||||||
|
public static class MathHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Verifies whether the value is NaN of Infinity.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The value to varify.</param>
|
||||||
|
/// <returns>True if the value is not NaN and is Infinity, false otherwise.</returns>
|
||||||
|
public static bool IsFinite(this double value)
|
||||||
|
{
|
||||||
|
return !Double.IsNaN(value) && !Double.IsInfinity(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clamps specified long value to specified interval.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">Value to clamp.</param>
|
||||||
|
/// <param name="min">Minimum of the interval.</param>
|
||||||
|
/// <param name="max">Maximum of the interval.</param>
|
||||||
|
/// <returns>Long value in range [min, max].</returns>
|
||||||
|
public static long Clamp(long value, long min, long max)
|
||||||
|
{
|
||||||
|
return Math.Max(min, Math.Min(value, max));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clamps specified double value to specified interval.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">Value to clamp.</param>
|
||||||
|
/// <param name="min">Minimum of the interval.</param>
|
||||||
|
/// <param name="max">Maximum of the interval.</param>
|
||||||
|
/// <returns>Double value in range [min, max].</returns>
|
||||||
|
public static double Clamp(double value, double min, double max)
|
||||||
|
{
|
||||||
|
return Math.Max(min, Math.Min(value, max));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Clamps specified double value to [0,1].</summary>
|
||||||
|
/// <param name="value">Value to clamp.</param>
|
||||||
|
/// <returns>Double value in range [0, 1].</returns>
|
||||||
|
public static double Clamp(double value)
|
||||||
|
{
|
||||||
|
return Math.Max(0, Math.Min(value, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clamps specified integer value to specified interval.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">Value to clamp.</param>
|
||||||
|
/// <param name="min">Minimum of the interval.</param>
|
||||||
|
/// <param name="max">Maximum of the interval.</param>
|
||||||
|
/// <returns>Integer value in range [min, max].</returns>
|
||||||
|
public static int Clamp(int value, int min, int max)
|
||||||
|
{
|
||||||
|
return Math.Max(min, Math.Min(value, max));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns <see cref="Rect"/> by four given coordinates of corner points.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="minX">X coordinate on a left-top corner.</param>
|
||||||
|
/// <param name="minY">Y coordinate on a left-top corner.</param>
|
||||||
|
/// <param name="maxX">X coordinate on a right-bottom corner.</param>
|
||||||
|
/// <param name="maxY">Y coordinate on a right-bottom corner.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Rect CreateRectByPoints(double minX, double minY, double maxX, double maxY)
|
||||||
|
{
|
||||||
|
return new Rect(new Point(minX, minY), new Point(maxX, maxY));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns <see cref="Rect"/> by given point of a center and <see cref="Size"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="center">Point of a center of a rectangle.</param>
|
||||||
|
/// <param name="size">Size of a rectangle.</param>
|
||||||
|
/// <returns>Rect.</returns>
|
||||||
|
public static Rect CreateRectFromCenterSize(Point center, Size size)
|
||||||
|
{
|
||||||
|
return new Rect(center.X - size.Width / 2, center.Y - size.Height / 2, size.Width, size.Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts an angle in radians to the angle in degrees.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="angleInRadians">Angle in radians.</param>
|
||||||
|
/// <returns>Angle in degrees.</returns>
|
||||||
|
public static double ToDegrees(this double angleInRadians)
|
||||||
|
{
|
||||||
|
return angleInRadians * 180 / Math.PI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
897
InteractiveDataDisplay_OneDll/src/Common/Palette.cs
Normal file
897
InteractiveDataDisplay_OneDll/src/Common/Palette.cs
Normal file
|
|
@ -0,0 +1,897 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
// Copyright © 2010 Microsoft Corporation, All Rights Reserved.
|
||||||
|
// This code released under the terms of the Microsoft Research License Agreement (MSR-LA, http://sds.codeplex.com/License)
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a point within the range of a palette, containing colors on the left and rigth sides.
|
||||||
|
/// </summary>
|
||||||
|
public class PalettePoint
|
||||||
|
{
|
||||||
|
private Color rightColor, leftColor;
|
||||||
|
private double x;
|
||||||
|
|
||||||
|
internal PalettePoint()
|
||||||
|
{}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="PalettePoint"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">Coordinate of a point.</param>
|
||||||
|
/// <param name="right">Color on a right side.</param>
|
||||||
|
/// <param name="left">Color on a left side.</param>
|
||||||
|
public PalettePoint(double x, Color right, Color left)
|
||||||
|
{
|
||||||
|
this.rightColor = right;
|
||||||
|
this.leftColor = left;
|
||||||
|
this.x = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the color on a right side of a point.
|
||||||
|
/// </summary>
|
||||||
|
public Color RightColor
|
||||||
|
{
|
||||||
|
internal set { rightColor = value; }
|
||||||
|
get { return rightColor; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the color on a left side of a point.
|
||||||
|
/// </summary>
|
||||||
|
public Color LeftColor
|
||||||
|
{
|
||||||
|
internal set { leftColor = value; }
|
||||||
|
get { return leftColor; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the coordinate of a point.
|
||||||
|
/// </summary>
|
||||||
|
public double X
|
||||||
|
{
|
||||||
|
internal set { x = value; }
|
||||||
|
get { return x; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string that represents the current palette point with information of coordinate and colors.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return String.Format(CultureInfo.InvariantCulture, "{0} - left: {1}, right: {2}", x, leftColor, rightColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines mapping between color and double value.
|
||||||
|
/// </summary>
|
||||||
|
public class Palette : IPalette
|
||||||
|
{
|
||||||
|
private bool isNormalized;
|
||||||
|
private Range range;
|
||||||
|
private PalettePoint[] points;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Predefined palette "Blue, Green, Red".
|
||||||
|
/// </summary>
|
||||||
|
public static Palette Heat = new Palette(true, new Range(0, 1),
|
||||||
|
new PalettePoint[3]{
|
||||||
|
new PalettePoint(0.0, Colors.Blue, Colors.Blue),
|
||||||
|
new PalettePoint(0.5, Color.FromArgb(255, 0, 255, 0), Color.FromArgb(255, 0, 255, 0)),
|
||||||
|
new PalettePoint(1.0, Colors.Red, Colors.Red)
|
||||||
|
});
|
||||||
|
|
||||||
|
// See http://www.geos.ed.ac.uk/it/howto/GMT/CPT/palettes.html
|
||||||
|
// public readonly static Palette Topo = Palette.Parse("#C977D9,#A18AE6,#8AA2E6,#8BD1E7,#8AF3CF,#85F38E,#EDE485,#F0B086,#DE9F8B,#74A3B3=0.5,#99CC70,#DCD68E,#BDF385,#EDDFAD,#F7E8CA,#FFF9F3,#FFF9F6,#FFFBF9,#FFFCFA,White");
|
||||||
|
|
||||||
|
private Palette()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes an instance of <see cref="Palette"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="isNormalized">Indicated whether palette is absolute or normalized.
|
||||||
|
/// If true, the actual range of palette is always [0...1].</param>
|
||||||
|
/// <param name="range">Range of palette.</param>
|
||||||
|
/// <param name="points">An array of color points.</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// <para>If <paramref name="isNormalized"/> is true, value of the <paramref name="range"/>
|
||||||
|
/// is ignored and actual range is always [0...1].</para>
|
||||||
|
/// <para>The array <paramref name="points"/> is cloned before use and therefore can be modified
|
||||||
|
/// after the constructor is completed without any effect on the palette instance.
|
||||||
|
/// </para>
|
||||||
|
/// </remarks>
|
||||||
|
public Palette(bool isNormalized, Range range, PalettePoint[] points)
|
||||||
|
{
|
||||||
|
this.isNormalized = isNormalized;
|
||||||
|
if (isNormalized)
|
||||||
|
this.range = new Range(0, 1);
|
||||||
|
else
|
||||||
|
this.range = new Range(range.Min, range.Max);
|
||||||
|
|
||||||
|
if (points == null) throw new ArgumentNullException("points");
|
||||||
|
if (points.Length < 2) throw new ArgumentException("Palette should have at least two points");
|
||||||
|
this.points = (PalettePoint[])points.Clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes new instance of <see cref="Palette"/> class on a basis of existing palette's colors.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="isNormalized">Indicated whether palette is absolute or normalized.
|
||||||
|
/// If true, the actual range of palette is always [0...1].</param>
|
||||||
|
/// <param name="range">Range of palette.</param>
|
||||||
|
/// <param name="palette">A palette to construct a new one.</param>
|
||||||
|
public Palette(bool isNormalized, Range range, Palette palette)
|
||||||
|
{
|
||||||
|
if (palette == null) throw new ArgumentNullException("palette");
|
||||||
|
this.isNormalized = isNormalized;
|
||||||
|
if (isNormalized)
|
||||||
|
this.range = new Range(0, 1);
|
||||||
|
else
|
||||||
|
this.range = range;
|
||||||
|
|
||||||
|
if (palette.IsNormalized == isNormalized)
|
||||||
|
{
|
||||||
|
points = (PalettePoint[])palette.points.Clone();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var srcRange = palette.Range;
|
||||||
|
double alpha, beta;
|
||||||
|
if (isNormalized) // from absolute to normalized
|
||||||
|
{
|
||||||
|
alpha = 1.0 / (srcRange.Max - srcRange.Min);
|
||||||
|
beta = -srcRange.Min * alpha;
|
||||||
|
}
|
||||||
|
else // from normalized to absolute
|
||||||
|
{
|
||||||
|
alpha = range.Max - range.Min;
|
||||||
|
beta = range.Min;
|
||||||
|
}
|
||||||
|
points = palette.points.Select(pp => new PalettePoint(pp.X * alpha + beta, pp.RightColor, pp.LeftColor)).ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the points with colors describing the palette.
|
||||||
|
/// </summary>
|
||||||
|
public PalettePoint[] Points
|
||||||
|
{
|
||||||
|
get { return points.Clone() as PalettePoint[]; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parses the palette from the string. See remarks for details.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">A string to parse from.</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// <para>String can contain: names of colors (<see cref="System.Windows.Media.Color"/> or hexadecimal representation #AARRGGBB),
|
||||||
|
/// double values and separators (equal symbol or comma) to separate colors and values from each other. </para>
|
||||||
|
/// <para>Comma is used for gradient colors, equal symbol - for initializing a color of specified value.</para>
|
||||||
|
/// <para>Palette can be normalized or absolute.</para>
|
||||||
|
/// <para>Absolute palette maps entire numbers to colors exactly as numbers are specified. For examples,
|
||||||
|
/// palette '-10=Blue,Green,Yellow,Red=10' maps values -10 and below to Blue, 10 and above to red.</para>
|
||||||
|
/// <para>Normalized palette maps minimum value to left palette color, maximum value to right palette color. In normalized palette
|
||||||
|
/// no numbers on left and right sides are specified.</para>
|
||||||
|
/// <para>Palettes can contain regions of constant color. For example, palette 'Blue=0.25=Yellow=0.5=#00FF00=0.75=Orange' maps first quarter of
|
||||||
|
/// values to blue, second quarter to yellow and so on.</para>
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>A palette that specified string describes.</returns>
|
||||||
|
public static Palette Parse(string value)
|
||||||
|
{
|
||||||
|
bool isNormalized = true;
|
||||||
|
Range range;
|
||||||
|
List<PalettePoint> points = new List<PalettePoint>();
|
||||||
|
|
||||||
|
if (value == null) value = String.Empty;
|
||||||
|
if (String.IsNullOrEmpty(value))
|
||||||
|
return new Palette(true, new Range(0, 1), new PalettePoint[2]{
|
||||||
|
new PalettePoint(0.0, Colors.White, Colors.White),
|
||||||
|
new PalettePoint(1.0, Colors.Black, Colors.Black)});
|
||||||
|
Lexer lexer = new Lexer(value);
|
||||||
|
int state = -1;
|
||||||
|
double lastNumber;
|
||||||
|
if (lexer.ReadNext())
|
||||||
|
{
|
||||||
|
points.Add(new PalettePoint(0.0, Colors.White, Colors.White));
|
||||||
|
if (lexer.CurrentLexeme == Lexer.LexemeType.Number)
|
||||||
|
{
|
||||||
|
points[points.Count - 1].X = lexer.ValueNumber;
|
||||||
|
isNormalized = false;
|
||||||
|
if (lexer.ReadNext() && lexer.CurrentLexeme != Lexer.LexemeType.Separator)
|
||||||
|
throw new PaletteFormatException(lexer.Position, "separator expected");
|
||||||
|
if (lexer.ReadNext() && lexer.CurrentLexeme != Lexer.LexemeType.Color)
|
||||||
|
throw new PaletteFormatException(lexer.Position, "color expected");
|
||||||
|
}
|
||||||
|
if (lexer.CurrentLexeme == Lexer.LexemeType.Color)
|
||||||
|
{
|
||||||
|
points[points.Count - 1].RightColor = lexer.ValueColor;
|
||||||
|
points[points.Count - 1].LeftColor = lexer.ValueColor;
|
||||||
|
points.Add(new PalettePoint(points[0].X, lexer.ValueColor, lexer.ValueColor));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new PaletteFormatException(lexer.Position, "wrong lexeme");
|
||||||
|
}
|
||||||
|
lastNumber = points[0].X;
|
||||||
|
while (lexer.ReadNext())
|
||||||
|
{
|
||||||
|
if (lexer.CurrentLexeme == Lexer.LexemeType.Separator)
|
||||||
|
{
|
||||||
|
if (lexer.ValueSeparator == Lexer.Separator.Equal)
|
||||||
|
{
|
||||||
|
if (lexer.ReadNext())
|
||||||
|
{
|
||||||
|
if (lexer.CurrentLexeme == Lexer.LexemeType.Number)
|
||||||
|
{
|
||||||
|
if (lexer.ValueNumber < lastNumber)
|
||||||
|
throw new PaletteFormatException(lexer.Position, "number is less than previous");
|
||||||
|
lastNumber = lexer.ValueNumber;
|
||||||
|
if (state == -1)
|
||||||
|
{
|
||||||
|
//x1 = color = x2
|
||||||
|
points[points.Count - 1].X = lexer.ValueNumber;
|
||||||
|
state = 1;
|
||||||
|
}
|
||||||
|
else if (state == 0)
|
||||||
|
{
|
||||||
|
//color = x
|
||||||
|
points[points.Count - 1].X = lexer.ValueNumber;
|
||||||
|
state = 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new PaletteFormatException(lexer.Position, "wrong lexeme");
|
||||||
|
}
|
||||||
|
else if (lexer.CurrentLexeme == Lexer.LexemeType.Color)
|
||||||
|
{
|
||||||
|
if (state == 1 || state == 2)
|
||||||
|
{
|
||||||
|
//x = color (,x=color || color1=x=color2)
|
||||||
|
points[points.Count - 1].RightColor = lexer.ValueColor;
|
||||||
|
state = -1;
|
||||||
|
}
|
||||||
|
else if (state == 0 || state == -1)
|
||||||
|
{
|
||||||
|
//color1 = color2
|
||||||
|
points[points.Count - 1].X = points[0].X - 1;
|
||||||
|
points[points.Count - 1].RightColor = lexer.ValueColor;
|
||||||
|
state = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new PaletteFormatException(lexer.Position, "wrong lexeme");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new PaletteFormatException(lexer.Position, "wrong lexeme");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (lexer.ValueSeparator == Lexer.Separator.Comma)
|
||||||
|
{
|
||||||
|
if (lexer.ReadNext())
|
||||||
|
{
|
||||||
|
if (state == 1 || state == -1 || state == 2)
|
||||||
|
{
|
||||||
|
if (lexer.CurrentLexeme == Lexer.LexemeType.Number)
|
||||||
|
{
|
||||||
|
if (lexer.ValueNumber <= lastNumber)
|
||||||
|
throw new PaletteFormatException(lexer.Position, "number is less than previous");
|
||||||
|
lastNumber = lexer.ValueNumber;
|
||||||
|
//x1 = color, x2
|
||||||
|
if (lexer.ReadNext() && lexer.CurrentLexeme == Lexer.LexemeType.Separator && lexer.ValueSeparator == Lexer.Separator.Equal)
|
||||||
|
{
|
||||||
|
if (lexer.ReadNext() && lexer.CurrentLexeme == Lexer.LexemeType.Color)
|
||||||
|
{
|
||||||
|
if (state != -1)
|
||||||
|
points.Add(new PalettePoint(lexer.ValueNumber, lexer.ValueColor, lexer.ValueColor));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
points[points.Count - 1].X = lexer.ValueNumber;
|
||||||
|
points[points.Count - 1].RightColor = lexer.ValueColor;
|
||||||
|
points[points.Count - 1].LeftColor = lexer.ValueColor;
|
||||||
|
}
|
||||||
|
state = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new PaletteFormatException(lexer.Position, "color expected");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new PaletteFormatException(lexer.Position, "wrong lexeme");
|
||||||
|
}
|
||||||
|
else if (lexer.CurrentLexeme == Lexer.LexemeType.Color)
|
||||||
|
{
|
||||||
|
// x = color1, color2
|
||||||
|
if (state == -1)
|
||||||
|
points.RemoveAt(points.Count - 1);
|
||||||
|
state = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new PaletteFormatException(lexer.Position, "wrong lexeme");
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (state == 0)
|
||||||
|
{
|
||||||
|
if (lexer.CurrentLexeme == Lexer.LexemeType.Number)
|
||||||
|
{
|
||||||
|
if (lexer.ValueNumber <= lastNumber)
|
||||||
|
throw new PaletteFormatException(lexer.Position, "number is less than previous");
|
||||||
|
lastNumber = lexer.ValueNumber;
|
||||||
|
//color, x
|
||||||
|
points[points.Count - 1].X = points[0].X - 1;
|
||||||
|
if (lexer.ReadNext() && lexer.CurrentLexeme == Lexer.LexemeType.Separator && lexer.ValueSeparator == Lexer.Separator.Equal)
|
||||||
|
{
|
||||||
|
if (lexer.ReadNext() && lexer.CurrentLexeme == Lexer.LexemeType.Color)
|
||||||
|
{
|
||||||
|
points.Add(new PalettePoint(lexer.ValueNumber, lexer.ValueColor, lexer.ValueColor));
|
||||||
|
state = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new PaletteFormatException(lexer.Position, "color expected");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new PaletteFormatException(lexer.Position, "wrong lexeme");
|
||||||
|
}
|
||||||
|
else if (lexer.CurrentLexeme == Lexer.LexemeType.Color)
|
||||||
|
{
|
||||||
|
//color1, color2
|
||||||
|
points[points.Count - 1].X = points[0].X - 1;
|
||||||
|
state = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new PaletteFormatException(lexer.Position, "wrong lexeme");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (state == -1)
|
||||||
|
points.Add(new PalettePoint(points[0].X, lexer.ValueColor, lexer.ValueColor));
|
||||||
|
else if (state == 0)
|
||||||
|
points.Add(new PalettePoint(points[0].X, lexer.ValueColor, lexer.ValueColor));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new PaletteFormatException(lexer.Position, "separator expected");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lexer.CurrentLexeme == Lexer.LexemeType.Separator)
|
||||||
|
throw new PaletteFormatException(lexer.Position, "wrong lexeme");
|
||||||
|
if ((lexer.CurrentLexeme == Lexer.LexemeType.Number && isNormalized) ||
|
||||||
|
(lexer.CurrentLexeme == Lexer.LexemeType.Color && !isNormalized))
|
||||||
|
throw new PaletteFormatException(lexer.Position, "wrong ending");
|
||||||
|
if (isNormalized)
|
||||||
|
{
|
||||||
|
points[points.Count - 1].X = 1.0;
|
||||||
|
if (points[points.Count - 1].X < points[points.Count - 2].X)
|
||||||
|
throw new PaletteFormatException(lexer.Position, "number is less than previous");
|
||||||
|
}
|
||||||
|
points[points.Count - 1].RightColor = points[points.Count - 1].LeftColor;
|
||||||
|
if (points[0].X >= points[points.Count - 1].X)
|
||||||
|
throw new PaletteFormatException(lexer.Position, "wrong range of palette");
|
||||||
|
range = new Range(points[0].X, points[points.Count - 1].X);
|
||||||
|
|
||||||
|
int start = 1;
|
||||||
|
int count = 0;
|
||||||
|
for (int i = 1; i < points.Count; i++)
|
||||||
|
{
|
||||||
|
if (points[i].X == points[0].X - 1)
|
||||||
|
{
|
||||||
|
if (count == 0) start = i;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
else if (count != 0)
|
||||||
|
{
|
||||||
|
double res_x = (points[start + count].X - points[start - 1].X) / (count + 1);
|
||||||
|
for (int j = 0; j < count; j++)
|
||||||
|
points[start + j].X = points[start - 1].X + res_x * (j + 1);
|
||||||
|
count = 0;
|
||||||
|
start = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Palette(isNormalized, range, points.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ColorToString(Color color)
|
||||||
|
{
|
||||||
|
Type colors = typeof(Colors);
|
||||||
|
foreach (var property in colors.GetProperties())
|
||||||
|
{
|
||||||
|
if (((Color)property.GetValue(null, null)) == color)
|
||||||
|
return property.Name;
|
||||||
|
}
|
||||||
|
if (color.A == 0xff)
|
||||||
|
return string.Format(CultureInfo.InvariantCulture, "#{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B);
|
||||||
|
return string.Format(CultureInfo.InvariantCulture, "#{0:X2}{1:X2}{2:X2}{3:X2}", color.A, color.R, color.G, color.B);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string PositionToString(double x)
|
||||||
|
{
|
||||||
|
return x.ToString(CultureInfo.InvariantCulture);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a string that describes current palette.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>String that describes palette.</returns>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
int k = 0;
|
||||||
|
|
||||||
|
if (!IsNormalized)
|
||||||
|
sb.Append(PositionToString(points[k].X)).Append('=');
|
||||||
|
sb.Append(ColorToString(points[k].RightColor));
|
||||||
|
k++;
|
||||||
|
for (; k < points.Length - 1; k++)
|
||||||
|
{
|
||||||
|
if (points[k].LeftColor == points[k - 1].RightColor)
|
||||||
|
{
|
||||||
|
sb.Append('=').Append(PositionToString(points[k].X));
|
||||||
|
if (points[k].RightColor != points[k].LeftColor ||
|
||||||
|
(points[k].RightColor == points[k].LeftColor && points[k + 1].LeftColor == points[k].RightColor))
|
||||||
|
{
|
||||||
|
sb.Append('=');
|
||||||
|
sb.Append(ColorToString(points[k].RightColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sb.Append(',');
|
||||||
|
if (points[k].RightColor == points[k].LeftColor && points[k].LeftColor == points[k + 1].LeftColor)
|
||||||
|
{
|
||||||
|
sb.Append(PositionToString(points[k].X)).Append('=');
|
||||||
|
sb.Append(ColorToString(points[k].LeftColor));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sb.Append(ColorToString(points[k].LeftColor)).Append('=').Append(PositionToString(points[k].X));
|
||||||
|
if (points[k].RightColor == points[k + 1].LeftColor ||
|
||||||
|
points[k].RightColor != points[k].LeftColor)
|
||||||
|
{
|
||||||
|
sb.Append('=');
|
||||||
|
sb.Append(ColorToString(points[k].RightColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
k = points.Length - 1;
|
||||||
|
if (points[k].LeftColor != points[k - 1].RightColor)
|
||||||
|
{
|
||||||
|
sb.Append(',');
|
||||||
|
sb.Append(ColorToString(points[k].LeftColor));
|
||||||
|
}
|
||||||
|
if (!IsNormalized)
|
||||||
|
sb.Append('=').Append(PositionToString(points[k].X));
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IPalette Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a color for the specified value. Note that palette uses HSL interpolation of colors.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">A double value from <see cref="Range"/>.</param>
|
||||||
|
/// <returns>A color for specific double value.</returns>
|
||||||
|
public Color GetColor(double value)
|
||||||
|
{
|
||||||
|
Color color = new Color();
|
||||||
|
if (IsNormalized && (value > 1 || value < 0))
|
||||||
|
throw new ArgumentException("Wrong value for normalized palette");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (value <= points[0].X)
|
||||||
|
{
|
||||||
|
color.A = points[0].LeftColor.A;
|
||||||
|
color.R = points[0].LeftColor.R;
|
||||||
|
color.G = points[0].LeftColor.G;
|
||||||
|
color.B = points[0].LeftColor.B;
|
||||||
|
}
|
||||||
|
else if (value >= points[points.Length - 1].X)
|
||||||
|
{
|
||||||
|
color.A = points[points.Length - 1].RightColor.A;
|
||||||
|
color.R = points[points.Length - 1].RightColor.R;
|
||||||
|
color.G = points[points.Length - 1].RightColor.G;
|
||||||
|
color.B = points[points.Length - 1].RightColor.B;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
for (int i = 0; i < points.Length - 1; i++)
|
||||||
|
{
|
||||||
|
var p1 = points[i];
|
||||||
|
var p2 = points[i + 1];
|
||||||
|
if (value >= p1.X && value <= p2.X)
|
||||||
|
{
|
||||||
|
var c1 = p1.RightColor;
|
||||||
|
var c2 = p2.LeftColor;
|
||||||
|
double alpha = (value - points[i].X) / (p2.X - p1.X);
|
||||||
|
|
||||||
|
HSLColor cHSL1 = new HSLColor(c1);
|
||||||
|
HSLColor cHSL2 = new HSLColor(c2);
|
||||||
|
|
||||||
|
if (Math.Abs(cHSL2.H - cHSL1.H) > 3)
|
||||||
|
{
|
||||||
|
if (cHSL1.H < cHSL2.H)
|
||||||
|
cHSL1 = new HSLColor(cHSL1.A, cHSL1.H + 6, cHSL1.S, cHSL1.L);
|
||||||
|
else if (cHSL1.H > cHSL2.H)
|
||||||
|
cHSL2 = new HSLColor(cHSL2.A, cHSL2.H + 6, cHSL2.S, cHSL2.L);
|
||||||
|
}
|
||||||
|
|
||||||
|
HSLColor cHSL = new HSLColor(cHSL1.A + ((cHSL2.A - cHSL1.A) * alpha),
|
||||||
|
cHSL1.H + ((cHSL2.H - cHSL1.H) * alpha),
|
||||||
|
cHSL1.S + ((cHSL2.S - cHSL1.S) * alpha),
|
||||||
|
cHSL1.L + ((cHSL2.L - cHSL1.L) * alpha));
|
||||||
|
|
||||||
|
if (cHSL.H >= 6)
|
||||||
|
cHSL = new HSLColor(cHSL.A, cHSL.H - 6, cHSL.S, cHSL.L);
|
||||||
|
color = cHSL.ConvertToRGB();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the value indicating whether the <see cref="Range"/> is absolute or relative ([0, 1]).
|
||||||
|
/// </summary>
|
||||||
|
public bool IsNormalized
|
||||||
|
{
|
||||||
|
get { return isNormalized; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the range on which palette is defined.
|
||||||
|
/// </summary>
|
||||||
|
public Range Range
|
||||||
|
{
|
||||||
|
get { return range; }
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the specified palette is equal to the current instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">The palette to compare with current.</param>
|
||||||
|
/// <returns>True if the objects are equal, false otherwise.</returns>
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
if (obj == null) return false;
|
||||||
|
Palette p = obj as Palette;
|
||||||
|
if (p == null) return false;
|
||||||
|
if (isNormalized != p.isNormalized) return false;
|
||||||
|
if (range.Min != p.range.Min || range.Max != p.range.Max) return false;
|
||||||
|
int n = this.points.Length;
|
||||||
|
if (n != p.points.Length) return false;
|
||||||
|
for (int i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
var l = points[i];
|
||||||
|
var r = p.points[i];
|
||||||
|
if (l.X != r.X || l.LeftColor != r.LeftColor || l.RightColor != r.RightColor)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serves as a hash function for a palette type.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
int hash = isNormalized.GetHashCode() ^ range.GetHashCode();
|
||||||
|
for (int i = 0; i < points.Length; i++)
|
||||||
|
{
|
||||||
|
var l = points[i];
|
||||||
|
hash ^= l.X.GetHashCode() ^ l.LeftColor.GetHashCode() ^ l.RightColor.GetHashCode();
|
||||||
|
}
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class Lexer
|
||||||
|
{
|
||||||
|
public enum Separator { Equal, Comma };
|
||||||
|
public enum LexemeType { Color, Separator, Number };
|
||||||
|
|
||||||
|
LexemeType currentLexem;
|
||||||
|
Color valueColor;
|
||||||
|
double valueNumber;
|
||||||
|
Separator valueSeparator;
|
||||||
|
|
||||||
|
string paletteString;
|
||||||
|
int position;
|
||||||
|
|
||||||
|
public LexemeType CurrentLexeme
|
||||||
|
{
|
||||||
|
get { return currentLexem; }
|
||||||
|
}
|
||||||
|
public Color ValueColor
|
||||||
|
{
|
||||||
|
get { return valueColor; }
|
||||||
|
}
|
||||||
|
public double ValueNumber
|
||||||
|
{
|
||||||
|
get { return valueNumber; }
|
||||||
|
}
|
||||||
|
public Separator ValueSeparator
|
||||||
|
{
|
||||||
|
get { return valueSeparator; }
|
||||||
|
}
|
||||||
|
public int Position
|
||||||
|
{
|
||||||
|
get { return position; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Lexer(string value)
|
||||||
|
{
|
||||||
|
paletteString = value;
|
||||||
|
position = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ReadNext()
|
||||||
|
{
|
||||||
|
if (position >= paletteString.Length)
|
||||||
|
return false;
|
||||||
|
while (paletteString[position] == ' ') position++;
|
||||||
|
|
||||||
|
if (paletteString[position] == '#' || Char.IsLetter(paletteString[position]))
|
||||||
|
{
|
||||||
|
currentLexem = LexemeType.Color;
|
||||||
|
int start = position;
|
||||||
|
while (position < paletteString.Length && paletteString[position] != ' ' &&
|
||||||
|
paletteString[position] != '=' && paletteString[position] != ',')
|
||||||
|
{
|
||||||
|
position++;
|
||||||
|
}
|
||||||
|
string color = paletteString.Substring(start, position - start);
|
||||||
|
valueColor = GetColorFromString(color);
|
||||||
|
}
|
||||||
|
else if (paletteString[position] == '=' || paletteString[position] == ',')
|
||||||
|
{
|
||||||
|
currentLexem = LexemeType.Separator;
|
||||||
|
if (paletteString[position] == '=') valueSeparator = Separator.Equal;
|
||||||
|
else valueSeparator = Separator.Comma;
|
||||||
|
position++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentLexem = LexemeType.Number;
|
||||||
|
int start = position;
|
||||||
|
while (position < paletteString.Length && paletteString[position] != ' ' &&
|
||||||
|
paletteString[position] != '=' && paletteString[position] != ',')
|
||||||
|
{
|
||||||
|
position++;
|
||||||
|
}
|
||||||
|
string number = paletteString.Substring(start, position - start);
|
||||||
|
valueNumber = Double.Parse(number, CultureInfo.InvariantCulture);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color GetColorFromString(string str)
|
||||||
|
{
|
||||||
|
Color color = new Color();
|
||||||
|
|
||||||
|
if (Char.IsLetter(str[0]))
|
||||||
|
{
|
||||||
|
bool isNamed = false;
|
||||||
|
Type colors = typeof(Colors);
|
||||||
|
foreach (var property in colors.GetProperties())
|
||||||
|
{
|
||||||
|
if (property.Name == str)
|
||||||
|
{
|
||||||
|
color = (Color)property.GetValue(null, null);
|
||||||
|
isNamed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isNamed)
|
||||||
|
throw new PaletteFormatException(Position, "wrong name of color");
|
||||||
|
}
|
||||||
|
else if (str[0] == '#')
|
||||||
|
{
|
||||||
|
if (str.Length == 7)
|
||||||
|
{
|
||||||
|
color.A = 255;
|
||||||
|
color.R = Convert.ToByte(str.Substring(1, 2), 16);
|
||||||
|
color.G = Convert.ToByte(str.Substring(3, 2), 16);
|
||||||
|
color.B = Convert.ToByte(str.Substring(5, 2), 16);
|
||||||
|
}
|
||||||
|
else if (str.Length == 9)
|
||||||
|
{
|
||||||
|
color.A = Convert.ToByte(str.Substring(1, 2), 16);
|
||||||
|
color.R = Convert.ToByte(str.Substring(3, 2), 16);
|
||||||
|
color.G = Convert.ToByte(str.Substring(5, 2), 16);
|
||||||
|
color.B = Convert.ToByte(str.Substring(7, 2), 16);
|
||||||
|
}
|
||||||
|
else throw new PaletteFormatException(Position, "wrong name of color");
|
||||||
|
}
|
||||||
|
else throw new PaletteFormatException(Position, "wrong name of color");
|
||||||
|
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An exception that is thrown when an argument does not meet the parameter specifications
|
||||||
|
/// of <see cref="Palette"/> class methods.
|
||||||
|
/// </summary>
|
||||||
|
public class PaletteFormatException : FormatException
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="PaletteFormatException"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position">A position in a string in which an exception occured.</param>
|
||||||
|
/// <param name="message">A message to show.</param>
|
||||||
|
public PaletteFormatException(int position, string message) :
|
||||||
|
base(String.Format(CultureInfo.InvariantCulture, "Incorrect palette string at char {0}: {1}", position, message)) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="PaletteFormatException"/> class with default message.
|
||||||
|
/// </summary>
|
||||||
|
public PaletteFormatException() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="PaletteFormatException"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">A message to show.</param>
|
||||||
|
public PaletteFormatException(string message)
|
||||||
|
: base(message) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="PaletteFormatException"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">A message to show.</param>
|
||||||
|
/// <param name="innerException">An occured exception.</param>
|
||||||
|
public PaletteFormatException(string message, Exception innerException)
|
||||||
|
: base(message, innerException) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class HSLColor
|
||||||
|
{
|
||||||
|
private double h;
|
||||||
|
private double s;
|
||||||
|
private double l;
|
||||||
|
private double a;
|
||||||
|
|
||||||
|
public HSLColor(double a, double h, double s, double l)
|
||||||
|
{
|
||||||
|
this.a = a;
|
||||||
|
this.h = h;
|
||||||
|
this.s = s;
|
||||||
|
this.l = l;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HSLColor(Color color)
|
||||||
|
{
|
||||||
|
this.a = color.A / 255.0;
|
||||||
|
|
||||||
|
double r = color.R / 255.0;
|
||||||
|
double g = color.G / 255.0;
|
||||||
|
double b = color.B / 255.0;
|
||||||
|
|
||||||
|
double maxcolor = Math.Max(r, g);
|
||||||
|
maxcolor = Math.Max(maxcolor, b);
|
||||||
|
double mincolor = Math.Min(r, g);
|
||||||
|
mincolor = Math.Min(mincolor, b);
|
||||||
|
|
||||||
|
this.l = (maxcolor + mincolor) / 2.0;
|
||||||
|
|
||||||
|
if (maxcolor == mincolor)
|
||||||
|
this.s = 0.0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this.l < 0.5)
|
||||||
|
s = (maxcolor - mincolor) / (maxcolor + mincolor);
|
||||||
|
else
|
||||||
|
s = (maxcolor - mincolor) / (2.0 - maxcolor - mincolor);
|
||||||
|
}
|
||||||
|
if (maxcolor == mincolor)
|
||||||
|
this.h = 0;
|
||||||
|
else if (maxcolor == r)
|
||||||
|
{
|
||||||
|
if (g >= b)
|
||||||
|
this.h = (g - b) / (maxcolor - mincolor);
|
||||||
|
else
|
||||||
|
this.h = (g - b) / (maxcolor - mincolor) + 6.0;
|
||||||
|
}
|
||||||
|
else if (maxcolor == g)
|
||||||
|
this.h = 2.0 + (b - r) / (maxcolor - mincolor);
|
||||||
|
else if (maxcolor == b)
|
||||||
|
this.h = 4.0 + (r - g) / (maxcolor - mincolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color ConvertToRGB()
|
||||||
|
{
|
||||||
|
Color color = new Color();
|
||||||
|
color.A = (byte)(this.a * 255.0);
|
||||||
|
|
||||||
|
double c = (1.0 - Math.Abs(2.0 * this.l - 1.0)) * this.s;
|
||||||
|
double x = c * (1.0 - Math.Abs(this.h % 2.0 - 1.0));
|
||||||
|
|
||||||
|
if (this.h < 1 && this.h >= 0)
|
||||||
|
{
|
||||||
|
color.R = Convert.ToByte(c * 255.0);
|
||||||
|
color.G = Convert.ToByte(x * 255.0);
|
||||||
|
color.B = 0;
|
||||||
|
}
|
||||||
|
if (this.h < 2 && this.h >= 1)
|
||||||
|
{
|
||||||
|
color.R = Convert.ToByte(x * 255.0);
|
||||||
|
color.G = Convert.ToByte(c * 255.0);
|
||||||
|
color.B = 0;
|
||||||
|
}
|
||||||
|
if (this.h < 3 && this.h >= 2)
|
||||||
|
{
|
||||||
|
color.R = 0;
|
||||||
|
color.G = Convert.ToByte(c * 255.0);
|
||||||
|
color.B = Convert.ToByte(x * 255.0);
|
||||||
|
}
|
||||||
|
if (this.h < 4 && this.h >= 3)
|
||||||
|
{
|
||||||
|
color.R = 0;
|
||||||
|
color.G = Convert.ToByte(x * 255.0);
|
||||||
|
color.B = Convert.ToByte(c * 255.0);
|
||||||
|
}
|
||||||
|
if (this.h < 5 && this.h >= 4)
|
||||||
|
{
|
||||||
|
color.R = Convert.ToByte(x * 255.0);
|
||||||
|
color.G = 0;
|
||||||
|
color.B = Convert.ToByte(c * 255.0);
|
||||||
|
}
|
||||||
|
if (this.h < 6 && this.h >= 5)
|
||||||
|
{
|
||||||
|
color.R = Convert.ToByte(c * 255.0);
|
||||||
|
color.G = 0;
|
||||||
|
color.B = Convert.ToByte(x * 255.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
double m = (this.l - c / 2.0) * 255.0;
|
||||||
|
double temp = color.R + m;
|
||||||
|
if (temp > 255)
|
||||||
|
color.R = 255;
|
||||||
|
else if (temp < 0)
|
||||||
|
color.R = 0;
|
||||||
|
else
|
||||||
|
color.R = Convert.ToByte(temp);
|
||||||
|
|
||||||
|
temp = color.G + m;
|
||||||
|
if (temp > 255)
|
||||||
|
color.G = 255;
|
||||||
|
else if (temp < 0)
|
||||||
|
color.G = 0;
|
||||||
|
else
|
||||||
|
color.G = Convert.ToByte(color.G + m);
|
||||||
|
|
||||||
|
temp = color.B + m;
|
||||||
|
if (temp > 255)
|
||||||
|
color.B = 255;
|
||||||
|
else if (temp < 0)
|
||||||
|
color.B = 0;
|
||||||
|
else
|
||||||
|
color.B = Convert.ToByte(color.B + m);
|
||||||
|
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double A
|
||||||
|
{
|
||||||
|
get { return a; }
|
||||||
|
}
|
||||||
|
public double H
|
||||||
|
{
|
||||||
|
get { return h; }
|
||||||
|
}
|
||||||
|
public double S
|
||||||
|
{
|
||||||
|
get { return s; }
|
||||||
|
}
|
||||||
|
public double L
|
||||||
|
{
|
||||||
|
get { return l; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
173
InteractiveDataDisplay_OneDll/src/Common/Range.cs
Normal file
173
InteractiveDataDisplay_OneDll/src/Common/Range.cs
Normal file
|
|
@ -0,0 +1,173 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents ranges for double type.
|
||||||
|
/// </summary>
|
||||||
|
public struct Range
|
||||||
|
{
|
||||||
|
double minimum;
|
||||||
|
double maximum;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the minimum value of current range.
|
||||||
|
/// </summary>
|
||||||
|
public double Min
|
||||||
|
{
|
||||||
|
get { return minimum; }
|
||||||
|
set { minimum = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the maximum value of current range.
|
||||||
|
/// </summary>
|
||||||
|
public double Max
|
||||||
|
{
|
||||||
|
get { return maximum; }
|
||||||
|
set { maximum = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes new instance of range struct from given minimum and maximum values.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="minimum">Minimum value of the range.</param>
|
||||||
|
/// <param name="maximum">Maximum value of the range.</param>
|
||||||
|
public Range(double minimum, double maximum)
|
||||||
|
{
|
||||||
|
Debug.Assert(!double.IsNaN(minimum));
|
||||||
|
Debug.Assert(!double.IsNaN(maximum));
|
||||||
|
|
||||||
|
if (minimum < maximum)
|
||||||
|
{
|
||||||
|
this.minimum = minimum;
|
||||||
|
this.maximum = maximum;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.minimum = maximum;
|
||||||
|
this.maximum = minimum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Range(bool isEmpty)
|
||||||
|
{
|
||||||
|
if (isEmpty)
|
||||||
|
{
|
||||||
|
this.minimum = double.PositiveInfinity;
|
||||||
|
this.maximum = double.NegativeInfinity;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
minimum = 0;
|
||||||
|
maximum = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Readonly instance of empty range
|
||||||
|
/// </summary>
|
||||||
|
public static readonly Range Empty = new Range(true);
|
||||||
|
|
||||||
|
/// <summary>Returns true of this range contains no points (e.g. Min > Max).</summary>
|
||||||
|
public bool IsEmpty { get { return Min > Max; } }
|
||||||
|
|
||||||
|
/// <summary>Returns true of this range is a point (e.g. Min == Max).</summary>
|
||||||
|
public bool IsPoint { get { return Max == Min; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates current instance of <see cref="Range"/> with minimal range which contains current range and specified value
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">Value, which will be used for for current instance of range surrond</param>
|
||||||
|
public void Surround(double value)
|
||||||
|
{
|
||||||
|
if (value < minimum) minimum = value;
|
||||||
|
if (value > maximum) maximum = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates current instance of <see cref="Range"/> with minimal range which contains current range and specified range
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="range">Range, which will be used for current instance of range surrond</param>
|
||||||
|
public void Surround(Range range)
|
||||||
|
{
|
||||||
|
if (range.IsEmpty)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Surround(range.minimum);
|
||||||
|
Surround(range.maximum);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string that represents the current range.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>String that represents the current range</returns>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return "[" + minimum.ToString(CultureInfo.InvariantCulture) + "," + maximum.ToString(CultureInfo.InvariantCulture) + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculates range from current which will have the same center and which size will be larger in factor times
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="factor">Zoom factor</param>
|
||||||
|
/// <returns>Zoomed with specified factor range</returns>
|
||||||
|
public Range Zoom(double factor)
|
||||||
|
{
|
||||||
|
if (IsEmpty)
|
||||||
|
return new Range(true);
|
||||||
|
|
||||||
|
double delta = (Max - Min) / 2;
|
||||||
|
double center = (Max + Min) / 2;
|
||||||
|
|
||||||
|
return new Range(center - delta * factor, center + delta * factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the specified <see cref="Range"/> is equal to the current range.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">The range to compare with the current <see cref="Range"/>.</param>
|
||||||
|
/// <returns>True if the specified range is equal to the current range, false otherwise.</returns>
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
Range r = (Range)obj;
|
||||||
|
return r.minimum == minimum && r.maximum == maximum;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the hash code for this instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The hash code for current instance</returns>
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return minimum.GetHashCode() ^ maximum.GetHashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a value that indicates whether two specified range values are equal.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="first">The first value to compare.</param>
|
||||||
|
/// <param name="second">The second value to compare.</param>
|
||||||
|
/// <returns>True if values are equal, false otherwise.</returns>
|
||||||
|
public static bool operator ==(Range first, Range second)
|
||||||
|
{
|
||||||
|
return first.Equals(second);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a value that indicates whether two specified ranges values are not equal.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="first">The first value to compare.</param>
|
||||||
|
/// <param name="second">The second value to compare.</param>
|
||||||
|
/// <returns>True if values are not equal, false otherwise.</returns>
|
||||||
|
public static bool operator !=(Range first, Range second)
|
||||||
|
{
|
||||||
|
return !first.Equals(second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
444
InteractiveDataDisplay_OneDll/src/Figure.cs
Normal file
444
InteractiveDataDisplay_OneDll/src/Figure.cs
Normal file
|
|
@ -0,0 +1,444 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Linq;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace InteractiveDataDisplay.WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies the dock position of a child element that is inside a <see cref="Figure"/>
|
||||||
|
/// </summary>
|
||||||
|
public enum Placement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A child element that is positioned on the left side of the <see cref="Figure"/>
|
||||||
|
/// </summary>
|
||||||
|
Left,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A child element that is positioned at the top of the <see cref="Figure"/>
|
||||||
|
/// </summary>
|
||||||
|
Top,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A child element that is positioned on the right side of the <see cref="Figure"/>
|
||||||
|
/// </summary>
|
||||||
|
Right,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A child element that is positioned at the bottom of the <see cref="Figure"/>
|
||||||
|
/// </summary>
|
||||||
|
Bottom,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A child element that is positioned at the center of the <see cref="Figure"/>
|
||||||
|
/// </summary>
|
||||||
|
Center
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Figure class provides special layout options that are often found in charts.
|
||||||
|
/// It provides attached property Placement that allows to place child elements in center, left, top, right and bottom slots.
|
||||||
|
/// Figure override plot-to-screen transform, so that plot coordinates are mapped to the cental part of the Figure.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Figure class provides two-pass algorithm that prevents well-known loop occurring on resize of figure with fixed aspect ratio: figure resize forces update of plot-to-screen transform which adjusts labels on the axes.
|
||||||
|
/// Change of label size may result in change of central part size which again updates plot-to-screen transform which in turn leads to axes label updates and so on.
|
||||||
|
/// </remarks>
|
||||||
|
[Description("Plot with center, left, top, right and bottom slots")]
|
||||||
|
public class Figure : PlotBase
|
||||||
|
{
|
||||||
|
private double topHeight = 0;
|
||||||
|
private double topHeight2 = 0;
|
||||||
|
private double bottomHeight = 0;
|
||||||
|
private double bottomHeight2 = 0;
|
||||||
|
private double leftWidth = 0;
|
||||||
|
private double leftWidth2 = 0;
|
||||||
|
private double rightWidth = 0;
|
||||||
|
private double rightWidth2 = 0;
|
||||||
|
|
||||||
|
private Size centerSize = Size.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identify <see cref="Placement"/> attached property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty PlacementProperty = DependencyProperty.RegisterAttached(
|
||||||
|
"Placement",
|
||||||
|
typeof(Placement),
|
||||||
|
typeof(Figure),
|
||||||
|
new PropertyMetadata(Placement.Center, OnPlacementPropertyChanged));
|
||||||
|
|
||||||
|
private static void OnPlacementPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
FrameworkElement elt = sender as FrameworkElement;
|
||||||
|
if (elt != null) // TODO: What if sender is not a FrameworkElement
|
||||||
|
{
|
||||||
|
UIElement parent = elt.Parent as UIElement;
|
||||||
|
if (parent != null)
|
||||||
|
parent.InvalidateMeasure();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Gets or sets extra padding added to effective padding that is computed from all plots in composition</summary>
|
||||||
|
[Category("InteractiveDataDisplay")]
|
||||||
|
public Thickness ExtraPadding
|
||||||
|
{
|
||||||
|
get { return (Thickness)GetValue(ExtraPaddingProperty); }
|
||||||
|
set { SetValue(ExtraPaddingProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Identifies <see cref="ExtraPadding"/> dependency property</summary>
|
||||||
|
public static readonly DependencyProperty ExtraPaddingProperty =
|
||||||
|
DependencyProperty.Register("ExtraPadding", typeof(Thickness), typeof(Figure), new PropertyMetadata(new Thickness()));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Computes padding with maximum values for each side from padding of all children
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Padding with maximum values for each side from padding of all children</returns>
|
||||||
|
protected override Thickness AggregatePadding()
|
||||||
|
{
|
||||||
|
var ep = base.AggregatePadding();
|
||||||
|
return new Thickness(
|
||||||
|
ep.Left + ExtraPadding.Left,
|
||||||
|
ep.Top + ExtraPadding.Top,
|
||||||
|
ep.Right + ExtraPadding.Right,
|
||||||
|
ep.Bottom + ExtraPadding.Bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Measures the size in layout required for child elements and determines a size for the Figure.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="availableSize">The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available.</param>
|
||||||
|
/// <returns>The size that this element determines it needs during layout, based on its calculations of child element sizes.</returns>
|
||||||
|
protected override Size MeasureOverride(Size availableSize)
|
||||||
|
{
|
||||||
|
// Assuming we are master panel
|
||||||
|
var topElts = Children.Cast<UIElement>().Where(elt => GetPlacement(elt) == Placement.Top);
|
||||||
|
var bottomElts = Children.Cast<UIElement>().Where(elt => GetPlacement(elt) == Placement.Bottom);
|
||||||
|
var centerElts = Children.Cast<UIElement>().Where(elt => GetPlacement(elt) == Placement.Center);
|
||||||
|
var rightElts = Children.Cast<UIElement>().Where(elt => GetPlacement(elt) == Placement.Right);
|
||||||
|
var leftElts = Children.Cast<UIElement>().Where(elt => GetPlacement(elt) == Placement.Left);
|
||||||
|
|
||||||
|
DataRect desiredRect;
|
||||||
|
if (IsAutoFitEnabled)
|
||||||
|
{
|
||||||
|
desiredRect = AggregateBounds();
|
||||||
|
if (desiredRect.IsEmpty)
|
||||||
|
desiredRect = new DataRect(0, 0, 1, 1);
|
||||||
|
SetPlotRect(desiredRect, true);
|
||||||
|
}
|
||||||
|
else // resize
|
||||||
|
desiredRect = PlotRect;
|
||||||
|
|
||||||
|
//First Iteration: Measuring top and bottom slots,
|
||||||
|
//then meassuring left and right with top and bottom output values
|
||||||
|
|
||||||
|
// Create transform for first iteration
|
||||||
|
if (double.IsNaN(availableSize.Width) || double.IsNaN(availableSize.Height) ||
|
||||||
|
double.IsInfinity(availableSize.Width) || double.IsInfinity(availableSize.Height))
|
||||||
|
availableSize = new Size(100, 100);
|
||||||
|
|
||||||
|
Fit(desiredRect, availableSize);
|
||||||
|
|
||||||
|
// Measure top and bottom slots
|
||||||
|
double topBottomWidth = 0;
|
||||||
|
double topBottomHeight = 0;
|
||||||
|
topHeight = 0;
|
||||||
|
bottomHeight = 0;
|
||||||
|
|
||||||
|
foreach (var elt in topElts)
|
||||||
|
{
|
||||||
|
elt.Measure(availableSize);
|
||||||
|
var ds = elt.DesiredSize;
|
||||||
|
topBottomWidth = Math.Max(topBottomWidth, ds.Width);
|
||||||
|
topHeight += ds.Height;
|
||||||
|
}
|
||||||
|
topBottomHeight += topHeight;
|
||||||
|
|
||||||
|
foreach (var elt in bottomElts)
|
||||||
|
{
|
||||||
|
elt.Measure(availableSize);
|
||||||
|
var ds = elt.DesiredSize;
|
||||||
|
topBottomWidth = Math.Max(topBottomWidth, ds.Width);
|
||||||
|
bottomHeight += ds.Height;
|
||||||
|
}
|
||||||
|
topBottomHeight += bottomHeight;
|
||||||
|
|
||||||
|
// Measure left and right slots
|
||||||
|
double leftRightWidth = 0;
|
||||||
|
double leftRightHeight = 0;
|
||||||
|
leftWidth = 0;
|
||||||
|
rightWidth = 0;
|
||||||
|
|
||||||
|
foreach (var elt in leftElts)
|
||||||
|
{
|
||||||
|
|
||||||
|
elt.Measure(availableSize);
|
||||||
|
var ds = elt.DesiredSize;
|
||||||
|
leftRightHeight = Math.Max(leftRightHeight, ds.Height);
|
||||||
|
leftWidth += ds.Width;
|
||||||
|
}
|
||||||
|
leftRightWidth += leftWidth;
|
||||||
|
|
||||||
|
foreach (var elt in rightElts)
|
||||||
|
{
|
||||||
|
elt.Measure(availableSize);
|
||||||
|
var ds = elt.DesiredSize;
|
||||||
|
leftRightHeight = Math.Max(leftRightHeight, ds.Height);
|
||||||
|
rightWidth += ds.Width;
|
||||||
|
}
|
||||||
|
leftRightWidth += rightWidth;
|
||||||
|
|
||||||
|
//Measure center elements
|
||||||
|
Size availCenterSize = new Size(Math.Max(0, availableSize.Width - leftRightWidth), Math.Max(0, availableSize.Height - topBottomHeight));
|
||||||
|
Fit(desiredRect, availCenterSize);
|
||||||
|
|
||||||
|
foreach (var elt in centerElts)
|
||||||
|
{
|
||||||
|
elt.Measure(availCenterSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remeasure top and bottom slots
|
||||||
|
double topBottomWidth2 = 0;
|
||||||
|
double topBottomHeight2 = 0;
|
||||||
|
topHeight2 = 0;
|
||||||
|
bottomHeight2 = 0;
|
||||||
|
|
||||||
|
foreach (var elt in topElts)
|
||||||
|
{
|
||||||
|
elt.Measure(new Size(availCenterSize.Width, elt.DesiredSize.Height));
|
||||||
|
var ds = elt.DesiredSize;
|
||||||
|
topBottomWidth2 = Math.Max(topBottomWidth2, ds.Width);
|
||||||
|
topHeight2 += ds.Height;
|
||||||
|
}
|
||||||
|
topBottomHeight2 += topHeight2;
|
||||||
|
|
||||||
|
foreach (var elt in bottomElts)
|
||||||
|
{
|
||||||
|
elt.Measure(new Size(availCenterSize.Width, elt.DesiredSize.Height));
|
||||||
|
var ds = elt.DesiredSize;
|
||||||
|
topBottomWidth2 = Math.Max(topBottomWidth2, ds.Width);
|
||||||
|
bottomHeight2 += ds.Height;
|
||||||
|
}
|
||||||
|
topBottomHeight2 += bottomHeight2;
|
||||||
|
|
||||||
|
|
||||||
|
//Scaling elements of their new meassured height it not equal to first
|
||||||
|
if (bottomHeight2 > bottomHeight)
|
||||||
|
{
|
||||||
|
ScaleTransform transform = new ScaleTransform { ScaleY = bottomHeight / bottomHeight2 };
|
||||||
|
foreach (var elt in bottomElts)
|
||||||
|
{
|
||||||
|
elt.RenderTransform = transform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (topHeight2 > topHeight)
|
||||||
|
{
|
||||||
|
ScaleTransform transform = new ScaleTransform { ScaleY = topHeight / topHeight2 };
|
||||||
|
foreach (var elt in topElts)
|
||||||
|
{
|
||||||
|
elt.RenderTransform = transform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReMeasure left and right slots
|
||||||
|
double leftRightWidth2 = 0;
|
||||||
|
double leftRightHeight2 = 0;
|
||||||
|
leftWidth2 = 0;
|
||||||
|
rightWidth2 = 0;
|
||||||
|
|
||||||
|
foreach (var elt in leftElts)
|
||||||
|
{
|
||||||
|
elt.Measure(new Size(elt.DesiredSize.Width, availCenterSize.Height));
|
||||||
|
var ds = elt.DesiredSize;
|
||||||
|
leftRightHeight2 = Math.Max(leftRightHeight2, ds.Height);
|
||||||
|
leftWidth2 += ds.Width;
|
||||||
|
}
|
||||||
|
leftRightWidth2 += leftWidth2;
|
||||||
|
|
||||||
|
foreach (var elt in rightElts)
|
||||||
|
{
|
||||||
|
elt.Measure(new Size(elt.DesiredSize.Width, availCenterSize.Height));
|
||||||
|
var ds = elt.DesiredSize;
|
||||||
|
leftRightHeight2 = Math.Max(leftRightHeight2, ds.Height);
|
||||||
|
rightWidth2 += ds.Width;
|
||||||
|
}
|
||||||
|
leftRightWidth2 += rightWidth2;
|
||||||
|
|
||||||
|
//Scaling elements of their new meassured height it not equal to first
|
||||||
|
if (leftWidth2 > leftWidth)
|
||||||
|
{
|
||||||
|
ScaleTransform transform = new ScaleTransform { ScaleX = leftWidth / leftWidth2 };
|
||||||
|
foreach (var elt in leftElts)
|
||||||
|
{
|
||||||
|
elt.RenderTransform = transform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rightWidth2 > rightWidth)
|
||||||
|
{
|
||||||
|
ScaleTransform transform = new ScaleTransform { ScaleX = rightWidth / rightWidth2 };
|
||||||
|
foreach (var elt in rightElts)
|
||||||
|
{
|
||||||
|
elt.RenderTransform = transform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
centerSize = availCenterSize;
|
||||||
|
return new Size(availCenterSize.Width + leftRightWidth, availCenterSize.Height + topBottomHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Positions child elements and determines a size for a Figure
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="finalSize">The final area within the parent that Figure should use to arrange itself and its children</param>
|
||||||
|
/// <returns>The actual size used</returns>
|
||||||
|
protected override Size ArrangeOverride(Size finalSize)
|
||||||
|
{
|
||||||
|
var topElts = Children.Cast<UIElement>().Where(elt => GetPlacement(elt) == Placement.Top).ToArray();
|
||||||
|
var bottomElts = Children.Cast<UIElement>().Where(elt => GetPlacement(elt) == Placement.Bottom).ToArray();
|
||||||
|
var centerElts = Children.Cast<UIElement>().Where(elt => GetPlacement(elt) == Placement.Center);
|
||||||
|
var rightElts = Children.Cast<UIElement>().Where(elt => GetPlacement(elt) == Placement.Right).ToArray();
|
||||||
|
var leftElts = Children.Cast<UIElement>().Where(elt => GetPlacement(elt) == Placement.Left).ToArray();
|
||||||
|
|
||||||
|
double x = 0, y = 0;
|
||||||
|
|
||||||
|
//Arranging top elements and setting clip bounds
|
||||||
|
if (topHeight < topHeight2)
|
||||||
|
{
|
||||||
|
foreach (var elt in topElts)
|
||||||
|
{
|
||||||
|
double finalHeight = elt.DesiredSize.Height * topHeight / topHeight2;
|
||||||
|
elt.Arrange(new Rect(leftWidth, y, centerSize.Width, finalHeight));
|
||||||
|
elt.Clip = new RectangleGeometry { Rect = new Rect(-leftWidth, 0, finalSize.Width, finalHeight) };
|
||||||
|
y += finalHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double iy = topHeight;
|
||||||
|
for (int i = topElts.Length - 1; i > -1; i--)
|
||||||
|
{
|
||||||
|
UIElement elt = topElts[i];
|
||||||
|
elt.Arrange(new Rect(leftWidth, iy - elt.DesiredSize.Height, centerSize.Width, elt.DesiredSize.Height));
|
||||||
|
elt.Clip = new RectangleGeometry { Rect = new Rect(-leftWidth, 0, finalSize.Width, elt.DesiredSize.Height) };
|
||||||
|
iy -= elt.DesiredSize.Height;
|
||||||
|
}
|
||||||
|
y = topHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arranging left elements and setting clip bounds
|
||||||
|
if (leftWidth < leftWidth2)
|
||||||
|
{
|
||||||
|
foreach (var elt in leftElts)
|
||||||
|
{
|
||||||
|
double finalWidth = elt.DesiredSize.Width * leftWidth / leftWidth2;
|
||||||
|
elt.Arrange(new Rect(x, topHeight, finalWidth, centerSize.Height));
|
||||||
|
elt.Clip = new RectangleGeometry { Rect = new Rect(0, -topHeight, finalWidth, finalSize.Height) };
|
||||||
|
x += finalWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double ix = leftWidth;
|
||||||
|
for (int i = leftElts.Length - 1; i > -1; i--)
|
||||||
|
{
|
||||||
|
UIElement elt = leftElts[i];
|
||||||
|
elt.Arrange(new Rect(ix - elt.DesiredSize.Width, topHeight, elt.DesiredSize.Width, centerSize.Height));
|
||||||
|
elt.Clip = new RectangleGeometry { Rect = new Rect(0, -topHeight, elt.DesiredSize.Width, finalSize.Height) };
|
||||||
|
ix -= elt.DesiredSize.Width;
|
||||||
|
}
|
||||||
|
x = leftWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arranging center elements
|
||||||
|
foreach (var elt in centerElts)
|
||||||
|
{
|
||||||
|
elt.Arrange(new Rect(leftWidth, topHeight, centerSize.Width, centerSize.Height));
|
||||||
|
}
|
||||||
|
|
||||||
|
x += centerSize.Width;
|
||||||
|
y += centerSize.Height;
|
||||||
|
|
||||||
|
// Arranging bottom elements and setting clip bounds
|
||||||
|
if (bottomHeight < bottomHeight2)
|
||||||
|
{
|
||||||
|
foreach (var elt in bottomElts)
|
||||||
|
{
|
||||||
|
double finalHeight = elt.DesiredSize.Height * bottomHeight / bottomHeight2;
|
||||||
|
elt.Arrange(new Rect(leftWidth, y, centerSize.Width, finalHeight));
|
||||||
|
elt.Clip = new RectangleGeometry { Rect = new Rect(-leftWidth, 0, finalSize.Width, finalHeight) };
|
||||||
|
y += finalHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = bottomElts.Length - 1; i > -1; i--)
|
||||||
|
{
|
||||||
|
UIElement elt = bottomElts[i];
|
||||||
|
elt.Arrange(new Rect(leftWidth, y, centerSize.Width, elt.DesiredSize.Height));
|
||||||
|
elt.Clip = new RectangleGeometry { Rect = new Rect(-leftWidth, 0, finalSize.Width, elt.DesiredSize.Height) };
|
||||||
|
y += elt.DesiredSize.Height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arranging right elements and setting clip bounds
|
||||||
|
if (rightWidth < rightWidth2)
|
||||||
|
{
|
||||||
|
foreach (var elt in rightElts)
|
||||||
|
{
|
||||||
|
double finalWidth = elt.DesiredSize.Width * rightWidth / rightWidth2;
|
||||||
|
elt.Arrange(new Rect(x, topHeight, finalWidth, centerSize.Height));
|
||||||
|
elt.Clip = new RectangleGeometry { Rect = new Rect(0, -topHeight, finalWidth, finalSize.Height) };
|
||||||
|
x += finalWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = rightElts.Length - 1; i > -1; i--)
|
||||||
|
{
|
||||||
|
UIElement elt = rightElts[i];
|
||||||
|
elt.Arrange(new Rect(x, topHeight, elt.DesiredSize.Width, centerSize.Height));
|
||||||
|
elt.Clip = new RectangleGeometry { Rect = new Rect(0, -topHeight, elt.DesiredSize.Width, finalSize.Height) };
|
||||||
|
x += elt.DesiredSize.Width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Size(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the value of the <see cref="Placement"/> attached property to a specified element.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="element">The element to which the attached property is written.</param>
|
||||||
|
/// <param name="placement">The needed <see cref="Placement"/> value.</param>
|
||||||
|
public static void SetPlacement(DependencyObject element, Placement placement)
|
||||||
|
{
|
||||||
|
if (element == null)
|
||||||
|
throw new ArgumentNullException("element");
|
||||||
|
|
||||||
|
element.SetValue(PlacementProperty, placement);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the value of the <see cref="Placement"/> attached property to a specified element.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="element">The element from which the property value is read.</param>
|
||||||
|
/// <returns>The <see cref="Placement"/> property value for the element.</returns>
|
||||||
|
/// <remarks>The default value of FigurePlacement property is Placement.Center</remarks>
|
||||||
|
public static Placement GetPlacement(DependencyObject element)
|
||||||
|
{
|
||||||
|
if (element == null)
|
||||||
|
throw new ArgumentNullException("element");
|
||||||
|
|
||||||
|
return (Placement)element.GetValue(PlacementProperty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{2D34544C-2DF2-4B20-A43A-6C8D2DF3DD82}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>InteractiveDataDisplay.WPF</RootNamespace>
|
||||||
|
<AssemblyName>InteractiveDataDisplay.WPF</AssemblyName>
|
||||||
|
<TargetFrameworks>net452;net46</TargetFrameworks>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>TRACE;DEBUG;NETFRAMEWORK;NETFRAMEWORK;</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE;RELEASE;NETFRAMEWORK;;RELEASE;NETFRAMEWORK;RELEASE;NETFRAMEWORK;</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<LanguageTargets Condition="Exists('$(MSBuildExtensionsPath)\$(VisualStudioVersion)\Bin\Microsoft.CSharp.targets')">$(MSBuildExtensionsPath)\$(VisualStudioVersion)\Bin\Microsoft.CSharp.targets</LanguageTargets>
|
||||||
|
<Version>1.1.0</Version>
|
||||||
|
<Company>Microsoft; MSU ITIS Lab</Company>
|
||||||
|
<Authors>Sergey Berezin, Vassily Lyutsarev, Nikita Skoblov, Natalia Stepanova</Authors>
|
||||||
|
<Description>Interactive Data Display for WPF is a set of controls for adding interactive visualization of dynamic data to your application.</Description>
|
||||||
|
<Copyright>Copyright 2017 Microsoft Corporation</Copyright>
|
||||||
|
<PackageTags>idd wpf visualization plot plots plotting chart charting data interactive datavisualization</PackageTags>
|
||||||
|
<PackageProjectUrl>https://github.com/Microsoft/InteractiveDataDisplay.WPF</PackageProjectUrl>
|
||||||
|
<PackageLicenseUrl>https://github.com/Microsoft/InteractiveDataDisplay.WPF/blob/master/LICENSE</PackageLicenseUrl>
|
||||||
|
<SignAssembly>true</SignAssembly>
|
||||||
|
<DelaySign>false</DelaySign>
|
||||||
|
<AssemblyOriginatorKeyFile>sn.key.snk</AssemblyOriginatorKeyFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Windows" />
|
||||||
|
<Reference Include="System.Xaml" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
<!-- XAML elements -->
|
||||||
|
<!-- Workaround to make xamls appear in the VS solution explorer -->
|
||||||
|
<None Include="**\*.xaml" />
|
||||||
|
<Page Include="**\*.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Compile Update="**\*.xaml.cs" SubType="Code" DependentUpon="%(Filename)" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue