Comments (6)
I'm working on this
from plotly.net.
from plotly.net.
@kMutagene this is what we ended up playing with during the hackaton, in meantime it is useful to people lurking.
#r "nuget: Plotly.NET"
open Plotly.NET
open Plotly.NET.TraceObjects
let labelAndValues = [
"Child Care" , 44.8
"Public Transport", 27.2
"weather" , 19.6
"Traffic" , 56.
]
module Seq =
let unzip keyValues =
keyValues |> Seq.map fst
, keyValues |> Seq.map snd
type Chart with
static member Pareto(keysValues: seq<string * float>, ?Name: string, ?Label: string) =
let orderedLabels, orderedValues =
keysValues
|> Seq.sortByDescending snd
|> Seq.unzip
let sum = orderedValues |> Seq.sum
let topPaddingRatio = 0.05
let cumulativeSum =
Seq.scan (+) 0. orderedValues
|> Seq.skip 1
let paretoValues =
Seq.zip orderedLabels cumulativeSum
|> Seq.map (fun (label,value) -> label, value / sum * 100.)
let bars = Chart.Column(Seq.zip orderedLabels orderedValues,?Name=Name)
let points =
Chart.Point(
paretoValues
, ShowLegend = false
, Marker = Marker.init(Size = 8, Color = Color.fromKeyword Black, Symbol = StyleParam.MarkerSymbol.Cross, Angle = 45.)
)
|> Chart.withAxisAnchor (Y = 2)
let lines =
Chart.Line(
paretoValues
, Name = "Cumulative %"
, ShowLegend = true
)
|> Chart.withAxisAnchor (Y = 2)
[bars;lines;points]
|> Chart.combine
|> Chart.withYAxisStyle (
?TitleText = Label
, Id = StyleParam.SubPlotId.YAxis 1
, ShowGrid = false
, MinMax = (0.,sum * (1.+topPaddingRatio))
)
|> Chart.withYAxisStyle (
TitleText = "%"
, Side = StyleParam.Side.Right
, Id = StyleParam.SubPlotId.YAxis 2
, MinMax = (0.,100. * (1.+topPaddingRatio))
, Overlaying = StyleParam.LinearAxisId.Y 1
)
Chart.Pareto(labelAndValues, Name="Budget", Label="$") |> Chart.show
I intend to work with @rockfaith75 in order to make a full fledged PR that will meet the bar for integration in the library.
from plotly.net.
hey @rockfaith75 i think you worked on this together with @smoothdeveloper. Is one of you still planning to finish this? If not, I would greatly appreciate if you could link what you ended up with during the hackathon (e.g. a script or notebook you worked in) so others can use it as a foundation to tackle this chart. If also do not have anything to link, no worries, please just tell me that this issue is up-for-grabs again. Thanks ❤️
from plotly.net.
Hey @rockfaith75 cool that you are still working on this, take all the time you need.
I might be best reachable on the fslab discord server: https://discord.gg/k3kUtFY8DB
from plotly.net.
This has been merged 🥳 , thank you @smoothdeveloper and @rockfaith75 !
from plotly.net.
Related Issues (20)
- Generate C# bindings via code generation based on the core F# API
- Chart descriptions do not work if Cytoscape.NET.Interactive is referenced simultaneously HOT 4
- Contours should be accessible for PointDensity charts HOT 1
- How to create polar plots with Csharp HOT 3
- Suggestion: Documentation / Examples / Extensions for working with DataFrame objects HOT 1
- Exception when using .NET Polyglot Notebook due to strong naming HOT 3
- Add `WithTraceStyle` extension member to Plotly.NET.CSharp
- Plotly.Net.ImageExport ToBase64JPGString hangs in Blazor Server Application HOT 4
- load a custom font from file (ttf, woff, ...others) HOT 9
- With lastest plotly.net version (4.2), when plotting a Bubble3D chart ( or Scatter3D), x/y axis cannot be renamed HOT 4
- Unable to change the legend font size when global font size is defined in layout HOT 1
- plotly.js v2.28.0 compatibility needs huge rework of core API HOT 1
- Rework docs to use polyglot notebooks HOT 5
- Pie Chart's background doesnt change HOT 7
- No way to add guidelines (plotly.js has them) HOT 3
- Update documentation to dotnet interactive to 4.2.1 HOT 1
- `StyleParam.HoverInfo` is missing enum bindings
- Charts marked as `Responsive = true` are not responsive HOT 9
- Annotation not showing in C# HOT 2
- LinearAxis CategoryOrder not working as expected HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plotly.net.