Skip to content

Commit a8cc309

Browse files
author
horkerps
committed
Update README.md
1 parent f9be85e commit a8cc309

1 file changed

Lines changed: 8 additions & 239 deletions

File tree

README.md

Lines changed: 8 additions & 239 deletions
Original file line numberDiff line numberDiff line change
@@ -1,255 +1,24 @@
11
# OxyPlot CLI
22

3-
OxyPlot CLI is a PowerShell module for using the [OxyPlot](http://www.oxyplot.org) library on commnad line.
3+
![Example](https://github.com/horkerps/oxyplotcli/wiki/images/scatter.png)
44

5-
OxyPlot CLI is designed for both interactive usage and complex, sophisticated visualization scripting. It supports all series, axes and annotations of OxyPlot.
5+
OxyPlot CLI is a PowerShell module for using [OxyPlot](http://www.oxyplot.org), the .NET chart library, on commnad line.
66

7-
OxyPlot CLI provides the 'style' feature. A style can apply a set of visual properties to the chart at once. Currently, one style named 'ggplot' is provided. You can define your own style.
7+
OxyPlot CLI is designed for both interactive usage and elaborate visualization scripting. It supports all series, axes and annotations of OxyPlot.
8+
9+
OxyPlot CLI also supports 'styles'. A style can apply a set of visual properties to a chart at once. Currently, the 'ggplot' style is provided. You can define your own style.
810

911
## Installation
1012

11-
OxyPLot CLI is available in [PowerShell Gallery](https://www.powershellgallery.com).
13+
OxyPLot CLI is available in [PowerShell Gallery](https://www.powershellgallery.com/packages/oxyplotcli).
1214

1315
```PowerShell
14-
Install-Package oxyplotcli
16+
Install-Module oxyplotcli
1517
```
1618

1719
## Usage
1820

19-
### Series, axis and annotation creation cmdlets
20-
21-
OxyPlot CLI provides cmdlets corresponding to series, axis and annotation classes in OxyPlot. By calling these cmdlets, you can create any object of the type that the cmdlet name suggests.
22-
23-
(TBD: aliases)
24-
25-
* Series cmdlets
26-
27-
- New-OxyAreaSeries (class: OxyPlot.Series.AreaSeries)
28-
- New-OxyBarSeries (class: OxyPlot.Series.BarSeries)
29-
- New-OxyBoxPlotSeries (class: OxyPlot.Series.BoxPlotSeries)
30-
- New-OxyCandleStickAndVolumeSeries (class: OxyPlot.Series.CandleStickAndVolumeSeries)
31-
- New-OxyCandleStickSeries (class: OxyPlot.Series.CandleStickSeries)
32-
- New-OxyColumnSeries (class: OxyPlot.Series.ColumnSeries)
33-
- New-OxyContourSeries (class: OxyPlot.Series.ContourSeries)
34-
- New-OxyErrorColumnSeries (class: OxyPlot.Series.ErrorColumnSeries)
35-
- New-OxyFunctionSeries (class: OxyPlot.Series.FunctionSeries)
36-
- New-OxyHeatMapSeries (class: OxyPlot.Series.HeapMapSeries)
37-
- New-OxyHighLowSeries (class: OxyPlot.Series.HighLowSeries)
38-
- New-OxyIntervalBarSeries (class: OxyPlot.Series.IntervalBarSeries)
39-
- New-OxyLinearBarSeries (class: OxyPlot.Series.LinearBarSeries)
40-
- New-OxyLineSeries (class: OxyPlot.Series.LineSeries)
41-
- New-OxyPieSeries (class: OxyPlot.Series.PieSeries)
42-
- New-OxyRectangleBarSeries (class: OxyPlot.Series.RectangleBarSeries)
43-
- New-OxyScatterErrorSeries (class: OxyPlot.Series.ScatterErrorSeries)
44-
- New-OxyScatterSeries (class: OxyPlot.Series.ScatterSeries)
45-
- New-OxyStairStepSeries (class: OxyPlot.Series.StairStepSeries)
46-
- New-OxyStemSeries (class: OxyPlot.Series.StemSeries)
47-
- New-OxyThreeColorLineSeries (class: OxyPlot.Series.ThreeColorLineSeries)
48-
- New-OxyTornadoBarSeries (class: OxyPlot.Series.TornadoBarSeries)
49-
- New-OxyTwoColorAreaSeries (class: OxyPlot.Series.TwoColorAreaSeries)
50-
- New-OxyTwoColorLineSeries (class: OxyPlot.Series.TwoColorLineSeries)
51-
- New-OxyVolumeSeries (class: OxyPlot.Series.VolumeSeries)
52-
53-
* Axis cmdlets
54-
55-
- New-OxyAngleAxis (class: OxyPlot.Axes.AngleAxis)
56-
- New-OxyCategoryAxis (class: OxyPlot.Axes.CategoryAxis)
57-
- New-OxyDateTimeAxis (class: OxyPlot.Axes.DateTimeAxis)
58-
- New-OxyLinearAxis (class: OxyPlot.Axes.LinearAxis)
59-
- New-OxyLinearColorAxis (class: OxyPlot.Axes.ColorAxis)
60-
- New-OxyLogarithmicAxis (class: OxyPlot.Axes.LogarithmicAxis)
61-
- New-OxyMagnitudeAxis (class: OxyPlot.Axes.MagnitudeAxis)
62-
- New-OxyRangeColorAxis (class: OxyPlot.Axes.RangeColorAxis)
63-
- New-OxyTimeSpanAxis (class: OxyPlot.Axes.TimeSpanAxis)
64-
65-
* Annotation cmdlets
66-
67-
- New-OxyArrowAnnotation (class: OxyPlot.Annotations.ArrowAnnotation)
68-
- New-OxyEllipseAnnotation (class: OxyPlot.Annotations.EllipseAnnotation)
69-
- New-OxyFunctionAnnotation (class: OxyPlot.Annotations.FunctionAnnotation)
70-
- New-OxyImageAnnotation (class: OxyPlot.Annotations.ImageAnnotation)
71-
- New-OxyLineAnnotation (class: OxyPlot.Annotations.LineAnnotation)
72-
- New-OxyPointAnnotation (class: OxyPlot.Annotations.PointAnnotation)
73-
- New-OxyPolygonAnnotation (class: OxyPlot.Annotations.PolygonAnnotation)
74-
- New-OxyPolylineAnnotation (class: OxyPlot.Annotations.PolylineAnnotation)
75-
- New-OxyRectangleAnnotation (class: OxyPlot.Annotations.RectangleAnnotation)
76-
- New-OxyTextAnnotation (class: OxyPlot.Annotations.TextAnnotation)
77-
78-
#### Object properties to parameters
79-
80-
These cmdlets provide the parameters corresponding to the properties of the corresponding classes. With these parameters, you can set any property values of an object instance.
81-
82-
For example, the following script:
83-
84-
```PowerShell
85-
$line = New-OxyLineSeries -Color red -LineStyle Dash
86-
```
87-
88-
is equivalent to the following code in C#:
89-
```C#
90-
var line = new LineSeries();
91-
line.Color = OxyColors.Red;
92-
line.LineStyle = LineStyle.Dash;
93-
```
94-
95-
Note: Several properties with non-scalar types are interpreted by the converters to help users express the values of such parameters on command line. The `Color` property is one example. (TBD: details)
96-
97-
#### Data points
98-
99-
Most of series objects need a set of a specific kind of data points (or items). For example, `LineSeries` takes data points containing the `X` and `Y` elements, and `PieSeries` takes items containing the `Label` and `Value` elements.
100-
101-
You can assign data points (or items) to a series object in two ways.
102-
103-
##### Direct assignment
104-
105-
Each cmdlet provides parameters with the names of the data point elements. You can provide a set of elements with these parameters. For example, the `-X` and `-Y` parameters are defined in `New-OxyLineSeries`.
106-
107-
```PowerShell
108-
$line = New-OxyLineSeries -X 1, 2, 3 -Y 21, 35, 17
109-
```
110-
111-
The above code assigns three points (X, Y) = (1, 21) , (2, 35) and (3, 17) to a LineSeries object. Not to mention, the numbers of those elements should be the same.
112-
113-
##### Through pipeline
114-
115-
You can give a data source to a cmdlet through pipeline, and specify mappings between the data source and the data point elements by cmdlet parameters. The names of such parameters begin with element names, followed by `Name`. For example, the `New-OxyLineSeries` cmdlet provides the `-XName` and `-YName` parameters.
116-
117-
```PowerShell
118-
$data = Import-Csv datasets\iris.csv
119-
$line = $data | New-OxyLineSeries -XName Sepal.Width -YName Sepal.Length
120-
```
121-
(`datasets\iris.csv` are installed in the same folder where the module is installed.)
122-
123-
### Plot model cmdlets
124-
125-
In OxyPlot, series, axes and annotations are aggregated to a plot model to form a chart. A plot model is represented by the `OxyPlot.PlotModel` class.
126-
127-
Several cmdlets are defined to create, manipulate, and display a chart based on a plot model.
128-
129-
#### Basic operations
130-
131-
The `New-OxyPlotModel` cmdlet is a basic cmdlet to create an `OxyPlot.PlotModel` object. The `Add-OxyObjectToPlotModel` cmdlet can be used to add series, axes and annotations to a plot model. The `Show-OxyPlot` cmdlet takes a PlotModel object through pipeline, opens a window and plot a chart based on the plot model.
132-
133-
```PowerShell
134-
# Create a plot model
135-
$model = New-OxyPlotModel
136-
137-
# Prepare series objects
138-
$scatter = New-OxyScatterSeries
139-
$axis = New-OxyLogarithmicAxis
140-
141-
# Add them to a plot model
142-
Add-OxyObjectToPlotModel $scatter $model
143-
Add-OxyObjectToPlotModel $axis $model
144-
145-
# Display a chart
146-
$model | Show-OxyPlot
147-
```
148-
149-
#### Short representations for command-line usage
150-
151-
The `New-OxyPlotModel` accepts `-Show` parameter to display a chart immediately.
152-
153-
```PowerShell
154-
# An empty window appears
155-
$model = New-OxyPlotModel -Show
156-
```
157-
158-
In addition, object creation cmdlets, such as `New-OxyLineSeries`, provide the `-AddTo` parameter, which takes a plot model and adds a newly created object to it. When the `-AddTo` parameter is specified, the cmdlet returns no object, and the chart is updated immediately.
159-
160-
```PowerShell
161-
New-OxyLinearAxis -Position Bottom -AddTo $model
162-
New-OxyScatterSeries -AddTo $model
163-
```
164-
165-
By using these parameters, you can build up a chart in an interactive way.
166-
167-
As another way, you can give series objects as input objects of `New-OxyPlotModel` or `Show-OxyPlot`.
168-
169-
```PowerShell
170-
$scatter = New-OxyScatterSeries
171-
$line = New-OxyLineSeries
172-
173-
$model = $scatter, $line | New-OxyPlotModel
174-
```
175-
176-
You can use `Show-OxyPlot` to plot a chart in one line, if you don't need OxyPlot objects later.
177-
178-
```PowerShell
179-
oxyscat -X 1,2,3 -Y 4,5,6 | Show-OxyPlot
180-
```
181-
182-
#### Saving a chart as an image file
183-
184-
The `Save-OxyPlot` cmdlet works in a similar way to `Show-OxyPlot`, but saves the chart to an image file.
185-
186-
```PowerShell
187-
$model | Save-OxyPlot -OutFile chart.png -ImageWidth 800 -ImageHeight 600
188-
```
189-
190-
This cmdlet defines several parameters specific to image files: `-OutFile`, `-ImageWidth`, `-ImageHeight`, or `-ImageBackground`.
191-
192-
#### Additional parameters
193-
194-
For convinience, several sets of parameters are defined in `New-OxyPlotModel`, `Show-OxyPlot` and `Save-OxyPlot`.
195-
196-
First, these cmdlets accept `OxyPlot.PlotModel` properties as parameters, like the other object creation cmdlets do. The following script creates a PlotModel object and sets the property `Title` to "Example Chart" (and plot a chart).
197-
198-
```PowerShell
199-
$line | Show-OxyPlot -Title "Example Chart"
200-
```
201-
202-
Secondly, they take a set of parameters that begin with `-Ax` or `-Ay`.
203-
204-
The `-AxType` parameter specifies an axis class name for the X-axis of the plot model.
205-
206-
It can recognize a partial name of a class. In the following example, the value `log` matches the class name `OxyPlot.Axes.LogarithmicAxis`, so that a log-scale axis will appear.
207-
208-
```PowerShell
209-
$data = Import-Csv datasets\iris.csv
210-
$data | oxyscat -XName Sepal.Width -YName Sepal.Length | Show-OxyPlot -AxType log
211-
```
212-
213-
The other `-Ax` parameters correspond to the properties of the axis object, prefixed with `-Ax`. For example, `-AxTitle` sets the value of the `Title` property of the axis object.
214-
215-
The `-AyType` and the other `-Ay` parameters are the same for the Y-axis of the plot model.
216-
217-
## Advanced topics
218-
219-
### Grouping
220-
221-
All series creation cmdlets offer the `-Group`, `-GroupName`, `-GroupingKeys` parameters. These parameters are used to categorize the source data.
222-
223-
When the parameter `-Group` or `-GroupName` is given, the data is categorized based on the category data specified by `-Group`, or the column with the name specified by `-GroupName`. For each subset of the source data, a series object is created.
224-
225-
In the following example, a series object is created for each value in the `Species` column. Thus, several scatter points will appear in the single chart. When the color is not specified (automatic), each set of scatter points will be plotted in differenct colors.
226-
227-
```PowerShell
228-
$data = Import-Csv datasets\iris.csv
229-
$data | oxyscat -XName Sepal.Width -YName Sepal.Length -GroupName Species | Show-OxyPlot
230-
```
231-
232-
(TBD: -GroupingKeys)
233-
234-
### Style
235-
236-
(TBD)
237-
238-
### Multiple charts and sharing axes
239-
240-
(TBD)
241-
242-
### Direct object manipulation
243-
244-
(TBD)
245-
246-
### Window manipulation
247-
248-
(TBD)
249-
250-
### Axis type selection
251-
252-
(TBD)
21+
See [Wiki pages](https://github.com/horkerps/oxyplotcli/wiki).
25322

25423
## License
25524

0 commit comments

Comments
 (0)