Skip to content

Commit

Permalink
Added docs structure and API Reference docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
DashTheDev committed Jul 7, 2024
1 parent 922eb8b commit b21deb6
Show file tree
Hide file tree
Showing 12 changed files with 138 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You should open a discussion if all of the following apply:

- Opening an issue was not valid/appropriate.
- It is not a double up of a discussion that already exists.
- You want to discuss anything about the project, propose features or talk about certain issues.
- You want to discuss anything about the project, ask questions, propose features or talk about certain issues.
- You're willing to keep the discussion on track (day to day conversations should be held in private).

## Pull requests
Expand Down
5 changes: 5 additions & 0 deletions Docs/FAQ/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# [](../README.md) Frequently Asked Questions
Have some questions? Check the links below to see if we've answered it. Otherwise create a [discussion](https://github.com/DashTheDev/EZCharts.Maui.Donut/blob/master/.github/CONTRIBUTING.md#discussions)!

## Links
Coming soon...
9 changes: 9 additions & 0 deletions Docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Documentation
Welcome to the EZCharts.Maui.Donut documentation!

These docs are your one stop shop for everything you'll need to know about EZCharts.Maui.Donut. If there's anything that's missing or not explained well enough, feel free to make a [contribution](https://github.com/DashTheDev/EZCharts.Maui.Donut/blob/master/.github/CONTRIBUTING.md)!

## Links
- [API Reference](Reference/README.md)
- [Samples](Samples/README.md)
- [FAQ](FAQ/README.md)
14 changes: 14 additions & 0 deletions Docs/Reference/DataEntry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# [](README.md) DataEntry
A class used to act as the out of the box data entry model for setting up [`DonutChartView.EntriesSource`](DonutChartView.md).

```C#
public class DataEntry
```

**Inheritance:** [Object](https://learn.microsoft.com/en-us/dotnet/api/system.object?view=net-8.0) -> DataEntry

## Properties
| Name | Type | Default | Description |
|:-:|:-:|:-:|:-:|
| Value | [`float`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types#:~:text=.NET%20type-,float,-%C2%B11.5%20x%2010) | `0f` | The <see langword="float"/> value to use for determining the amount of chart area this entry will use. |
| Label | [`string`](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0) | `""` | The label to use for displaying what this entry represents. |
38 changes: 38 additions & 0 deletions Docs/Reference/DonutChartView.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# [](README.md) DonutChartView
A [SKCanvasView](https://github.com/mono/SkiaSharp/blob/main/source/SkiaSharp.Views.Maui/SkiaSharp.Views.Maui.Controls/SKCanvasView.cs) used to render customisable donut charts.

```C#
public class DonutChartView : SKCanvasView, IPadding
```

**Inheritance:** [Object](https://learn.microsoft.com/en-us/dotnet/api/system.object?view=net-8.0) -> [BindableObject](https://learn.microsoft.com/en-us/dotnet/api/microsoft.maui.controls.bindableobject?view=net-maui-8.0) -> [Element](https://learn.microsoft.com/en-us/dotnet/api/microsoft.maui.controls.element?view=net-maui-8.0) -> [NavigableElement](https://learn.microsoft.com/en-us/dotnet/api/microsoft.maui.controls.navigableelement?view=net-maui-8.0) -> [VisualElement](https://learn.microsoft.com/en-us/dotnet/api/microsoft.maui.controls.visualelement?view=net-maui-8.0) -> [View](https://learn.microsoft.com/en-us/dotnet/api/microsoft.maui.controls.view?view=net-maui-8.0) -> [SKCanvasView](https://github.com/mono/SkiaSharp/blob/main/source/SkiaSharp.Views.Maui/SkiaSharp.Views.Maui.Controls/SKCanvasView.cs) -> DonutChartView

**Implements:** [IPadding](https://learn.microsoft.com/en-us/dotnet/api/microsoft.maui.ipadding?view=net-maui-8.0)

## Events
| Name | Type | Description |
|:-:|:-:|:-:|
| EntryClicked | [`EntryClickEventArgs`](EntryClickEventArgs.md) | Raised whenever a segment on the chart is clicked. |

## Properties
| Name | Type | Bindable | Default | Description |
|:-:|:-:|:-:|:-:|:-:|
| EntriesSource | [`IEnumerable`](https://learn.microsoft.com/en-us/dotnet/api/system.collections.ienumerable?view=net-8.0) | ✅ | An empty [`ObservableCollection<object>`](https://learn.microsoft.com/en-us/dotnet/api/system.collections.objectmodel.observablecollection-1?view=net-8.0) | The source of entry data to be used for rendering the chart. It is expected that these entries be some sort of class with value and label properties. |
| EntryValuePath | [`string`](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0) | ✅ | `"Value"` | The path of the value property (expected to be of type [`float`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types#:~:text=.NET%20type-,float,-%C2%B11.5%20x%2010)) to be used for determining each entry's segment size. |
| EntryLabelPath | [`string`](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0) | ✅ | `"Label"` | The path of the label property (expected to be of type [`string`](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0)) to be used for a friendly display for each entry. |
| EntryIconTemplate | [`DataTemplate?`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.maui.controls.datatemplate?view=net-maui-8.0) | ✅ | `null` | The template to be used for rendering the image for each data entry. This template's resulting view is expected to be a [`FileImageSource`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.maui.controls.fileimagesource?view=net-maui-8.0). |
| EntryImageScale | [`float`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types#:~:text=.NET%20type-,float,-%C2%B11.5%20x%2010) | ✅ | `0.1f` | The scale to apply to the rendered entry image. |
| EntryColors | [`Color[]`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.maui.graphics.color?view=net-maui-8.0) | ✅ | `Blue, Green, Yellow, Purple, Orange` | The colors to use for representing each data entry on the chart. These colors will loop if there are more entries than colors. |
| EntryClickedCommand | [`ICommand?`](https://learn.microsoft.com/en-us/dotnet/api/system.windows.input.icommand?view=net-8.0) | ✅ | `null` | The command to be invoked when an entry is clicked. This command will receive an `object` parameter which represents the clicked entry. |
| Padding | [`Thickness`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.maui.thickness?view=net-maui-8.0) | ✅ | `10, 10, 10, 10` | The padding applied to the entire view. |
| ChartRotationDegrees | [`float`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types#:~:text=.NET%20type-,float,-%C2%B11.5%20x%2010) | ✅ | `90f` | The rotation offset to be applied to the chart. |
| ChartOuterRadius | [`float`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types#:~:text=.NET%20type-,float,-%C2%B11.5%20x%2010) | ✅ | `250f` | The radius of the outside ring of the chart. |
| ChartInnerRadius | [`float`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types#:~:text=.NET%20type-,float,-%C2%B11.5%20x%2010) | ✅ | `125f` | The radius of the inside ring of the chart. |
| LabelStyle | [`LabelStyle`](/LabelStyle.md) | ✅ | `LabelStyle.Key` | The style in which to display labels on the chart. |
| LabelFontFamily | [`string`](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0) | ✅ | `"Arial"` | The system font family to be used for rendering label text. |
| LabelFontColor | [`Color`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.maui.graphics.color?view=net-maui-8.0) | ✅ | `White` | The color used for rendering label text. |
| LabelUseAutoFontColor | [`bool`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool) | ✅ | `false` | Determines if each entry's color will be used to render the corresponding label text or not. |
| LabelFontSize | [`float`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types#:~:text=.NET%20type-,float,-%C2%B11.5%20x%2010) | ✅ | `20f` | The size used for rendering label text. |
| LabelKeySpacing | [`float`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types#:~:text=.NET%20type-,float,-%C2%B11.5%20x%2010) | ✅ | `10f` | The amount of vertical spacing between each label when `LabelStyle` is set to `LabelStyle.Key`. |
| LabelKeyColorOffset | [`float`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types#:~:text=.NET%20type-,float,-%C2%B11.5%20x%2010) | ✅ | `20f` | The amount of horizontal spacing between each label and its corresponding color when `LabelStyle` is set to `LabelStyle.Key`. |
| LabelOutsideRadius | [`float`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types#:~:text=.NET%20type-,float,-%C2%B11.5%20x%2010) | ✅ | `50f` | The radius from the `ChartOuterRadius` where entry labels will be rendered when `LabelStyle` is set to `LabelStyle.Outside`. |
13 changes: 13 additions & 0 deletions Docs/Reference/EntryClickEventArgs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# [](README.md) EntryClickEventArgs
An [EventArgs](https://learn.microsoft.com/en-us/dotnet/api/system.eventargs?view=net-8.0) class used to provide arguments for the [`DonutChartView.EntryClicked`](DonutChartView.md) event.

```C#
public sealed class EntryClickEventArgs(object entry) : EventArgs
```

**Inheritance:** [Object](https://learn.microsoft.com/en-us/dotnet/api/system.object?view=net-8.0) -> [EventArgs](https://learn.microsoft.com/en-us/dotnet/api/system.eventargs?view=net-8.0) -> EntryClickEventArgs

## Properties
| Name | Type | Description |
|:-:|:-:|:-:|
| Entry | [`object`](https://learn.microsoft.com/en-us/dotnet/api/system.object?view=net-8.0) | The data entry [`object`](https://learn.microsoft.com/en-us/dotnet/api/system.object?view=net-8.0) that was clicked. The type of this [`object`](https://learn.microsoft.com/en-us/dotnet/api/system.object?view=net-8.0) will be the same as the entry types bound to the [`DonutChartView.EntriesSource`](DonutChartView.md). |
14 changes: 14 additions & 0 deletions Docs/Reference/LabelStyle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# [](README.md) LabelStyle
An [`enumeration`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/enum) for adjusting how labels are displayed on the [`DonutChartView`](DonutChartView.md).

```C#
public enum LabelStyle
```

**Inheritance:** [Object](https://learn.microsoft.com/en-us/dotnet/api/system.object?view=net-8.0) -> [ValueType](https://learn.microsoft.com/en-us/dotnet/api/system.valuetype?view=net-8.0) -> [Enum](https://learn.microsoft.com/en-us/dotnet/api/system.enum?view=net-8.0) -> LabelStyle

## Fields
| Name | Value | Description |
|:-:|:-:|:-:|
| Key | `0` | Labels will be displayed to the side of the chart in a list format with their corresponding chart colors. |
| Outside | `1` | Labels will be displayed along the outer radius of the chart. |
8 changes: 8 additions & 0 deletions Docs/Reference/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# [](../README.md) API Reference
This is the documentation detailing the EZCharts.Maui.Donut public API.

## Links
- [DonutChartView](DonutChartView.md)
- [DataEntry](DataEntry.md)
- [EntryClickEventArgs](EntryClickEventArgs.md)
- [LabelStyle](LabelStyle.md)
5 changes: 5 additions & 0 deletions Docs/Samples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# [](../README.md) Samples
Want to see some code in action? Check the links below to help you get started.

## Links
Coming soon...
30 changes: 29 additions & 1 deletion EZCharts.Maui.Donut.sln
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,32 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub", "GitHub", "{1CB95A
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Issues", "Issues", "{D8F0DD70-4B6B-4827-BA0F-6D4759E82548}"
ProjectSection(SolutionItems) = preProject
.github\ISSUE_TEMPLATE\config.yml = .github\ISSUE_TEMPLATE\config.yml
.github\ISSUE_TEMPLATE\bug_report.md = .github\ISSUE_TEMPLATE\bug_report.md
.github\ISSUE_TEMPLATE\config.yml = .github\ISSUE_TEMPLATE\config.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{D488D0FE-380D-4651-AB99-47A3C58328AB}"
ProjectSection(SolutionItems) = preProject
Docs\README.md = Docs\README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Reference", "Reference", "{D45444B9-5527-43CE-8A1B-BF37D8230F20}"
ProjectSection(SolutionItems) = preProject
Docs\Reference\DataEntry.md = Docs\Reference\DataEntry.md
Docs\Reference\DonutChartView.md = Docs\Reference\DonutChartView.md
Docs\Reference\EntryClickEventArgs.md = Docs\Reference\EntryClickEventArgs.md
Docs\Reference\LabelStyle.md = Docs\Reference\LabelStyle.md
Docs\Reference\README.md = Docs\Reference\README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{B45E2321-2EAD-47F8-9EA0-8ED63E5A2B2B}"
ProjectSection(SolutionItems) = preProject
Docs\Samples\README.md = Docs\Samples\README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FAQ", "FAQ", "{816B3877-AE4B-4C30-AB71-4EDE4C6DAF97}"
ProjectSection(SolutionItems) = preProject
Docs\FAQ\README.md = Docs\FAQ\README.md
EndProjectSection
EndProject
Global
Expand All @@ -58,6 +82,10 @@ Global
{F4FE4592-8236-48E1-BAC8-B2294FE11E3B} = {A53374D6-1C72-478F-9876-F9D170C52793}
{1CB95A8E-B36F-4F9D-83CD-4BA4CAD0E6D4} = {A53374D6-1C72-478F-9876-F9D170C52793}
{D8F0DD70-4B6B-4827-BA0F-6D4759E82548} = {1CB95A8E-B36F-4F9D-83CD-4BA4CAD0E6D4}
{D488D0FE-380D-4651-AB99-47A3C58328AB} = {A53374D6-1C72-478F-9876-F9D170C52793}
{D45444B9-5527-43CE-8A1B-BF37D8230F20} = {D488D0FE-380D-4651-AB99-47A3C58328AB}
{B45E2321-2EAD-47F8-9EA0-8ED63E5A2B2B} = {D488D0FE-380D-4651-AB99-47A3C58328AB}
{816B3877-AE4B-4C30-AB71-4EDE4C6DAF97} = {D488D0FE-380D-4651-AB99-47A3C58328AB}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F0682CC5-7A84-4BE6-999A-027BBF9B7DA2}
Expand Down
2 changes: 1 addition & 1 deletion EZCharts.Maui.Donut/Controls/DonutChartView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ public float LabelFontSize
propertyChanged: OnVisualPropertyChanged);

/// <summary>
/// Gets or sets the spacing between each chart label.<br/>
/// Gets or sets the vertical spacing between each chart label.<br/>
/// This value is only applied when <c>LabelStyle</c> is set to <b><see cref="LabelStyle.Key"/></b>.<br/><br/>
/// This is a bindable property which defaults to <c>10f</c>.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ More detailed samples and documentation coming soon!
</donut:DonutChartView>
```

5. Customise to your liking! Options and samples can be found in the [documentation](/) (coming soon).
5. Customise to your liking! Options and samples can be found in the [documentation](https://github.com/DashTheDev/EZCharts.Maui.Donut/blob/master/Docs/README.md).
## 🤝 Contributing
I work full-time and may not have time to keep things up to date. So if there's something you want to change, then make some contributions! Please read the [contribution guide](https://github.com/DashTheDev/EZCharts.Maui.Donut/blob/master/.github/CONTRIBUTING.md) on how to get started.
Expand Down

0 comments on commit b21deb6

Please sign in to comment.