Skip to content

Commit e28142e

Browse files
authored
Merge pull request #23 from erossini/feature/add-zoom
Add zoom - Clean the projects
2 parents e99511c + 5616644 commit e28142e

34 files changed

+5687
-44
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ bld/
3636
.idea/
3737
# Visual Studio 2015/2017 cache/options directory
3838
.vs/
39+
# auto git log
40+
.chglog/
3941
# Uncomment if you have tasks that create the project's static files in wwwroot
4042
#wwwroot/
4143

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
### Changelog
2+
3+
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
4+
5+
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). To regenerate the CHANGELOG run in the Windows PowerShell
6+
7+
```
8+
auto-changelog
9+
```
10+
11+
#### 0.8
12+
13+
> 21 October 2022
14+
15+
- crosshair [`#19`](https://github.com/erossini/BlazorChartjs/pull/19)
16+
- Create LICENSE [`#22`](https://github.com/erossini/BlazorChartjs/pull/22)
17+
- onmouseout [`#17`](https://github.com/erossini/BlazorChartjs/pull/17)
18+
- onhover added [`#16`](https://github.com/erossini/BlazorChartjs/pull/16)
19+
- tooltip callbacks [`#14`](https://github.com/erossini/BlazorChartjs/pull/14)
20+
- point hit radius [`#13`](https://github.com/erossini/BlazorChartjs/pull/13)
21+
- Thank you for this new PR :) [`#12`](https://github.com/erossini/BlazorChartjs/pull/12)
22+
- point radius for scatter [`#9`](https://github.com/erossini/BlazorChartjs/pull/9)
23+
- showLine + tension for scatter chart [`#8`](https://github.com/erossini/BlazorChartjs/pull/8)
24+
- Add Class to Chart.razor [`#6`](https://github.com/erossini/BlazorChartjs/pull/6)
25+
- First commit [`dcd9c05`](https://github.com/erossini/BlazorChartjs/commit/dcd9c05eb6814a7f19bf28d675a582988d624415)
26+
- Beautify code - Upgrade Chartjs to 3.9.1 [`f82db94`](https://github.com/erossini/BlazorChartjs/commit/f82db941ef0ea415b82e2b7e70f4188afd89114a)
27+
- Add all charts [`46641cc`](https://github.com/erossini/BlazorChartjs/commit/46641ccb0c1a2160fcd3ca7599863c40cfeaa2f4)

ChartjsDemo/ChartjsDemo.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,10 @@
2121
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
2222
</ItemGroup>
2323

24+
<ItemGroup>
25+
<Content Update="Pages\CrosshairPage.razor">
26+
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
27+
</Content>
28+
</ItemGroup>
29+
2430
</Project>

ChartjsDemo/Pages/AreaSimple.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@page "/areaSimple"
22

3-
<h3>Area Simple</h3>
3+
<h3>Zoom</h3>
44

55
<Chart Config="_config1" @ref="_chart1" Height="400px"></Chart>
66

@@ -13,7 +13,7 @@
1313
</p>
1414

1515
<CodeSnippet Language="Language.xml" Style="Style.VisualStudio">
16-
&ltChart Config="_config1" &#64;ref="_chart1">&lt;Chart>
16+
&ltChart Config="_config1" &#64;ref="_chart1">&lt;Chart>
1717
</CodeSnippet>
1818

1919
<p>
Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
@page "/crosshair"
2+
3+
<h3>Line with crosshair</h3>
4+
5+
<p>
6+
In every graph, you can add options. In the component, we added the <code>crossair</code>: this shows horizontal and vertical lines
7+
on the graph to identify better where a point is. See the example below.
8+
</p>
9+
10+
<h4>Horizontal crosshair</h4>
11+
12+
<Chart Config="_config1" @ref="_chart1" Height="400px"></Chart>
13+
14+
<CodeSnippet Language="Language.xml" Style="Style.VisualStudio">
15+
&ltChart Config="_config1" &#64;ref="_chart1">&lt;Chart>
16+
</CodeSnippet>
17+
18+
<CodeSnippet Language="Language.csharp" Style="Style.VisualStudio" LoadMainScript="false">
19+
private LineChartConfig? _config1;
20+
private Chart? _chart1;
21+
22+
protected override async Task OnInitializedAsync()
23+
_config1 = new LineChartConfig()
24+
{
25+
Options = new Options()
26+
{
27+
Plugins = new Plugins()
28+
{
29+
Crosshair = new Crosshair()
30+
{
31+
Vertical = new CrosshairLine()
32+
{
33+
Color = Colors.PaletteBorder1[0]
34+
}
35+
}
36+
}
37+
}
38+
};
39+
40+
_config1.Data.Labels = LineDataExamples.SimpleLineText;
41+
_config1.Data.Datasets.Add(new LineDataset()
42+
{
43+
Label = "My First Dataset",
44+
Data = LineDataExamples.SimpleLine.ToList(),
45+
BorderColor = Colors.PaletteBorder1.FirstOrDefault(),
46+
Tension = 0.1M,
47+
Fill = false
48+
});
49+
}
50+
</CodeSnippet>
51+
52+
<hr/>
53+
54+
<h4>Vertical crosshair</h4>
55+
56+
<Chart Config="_config2" @ref="_chart1" Height="400px"></Chart>
57+
58+
<CodeSnippet Language="Language.xml" Style="Style.VisualStudio">
59+
&ltChart Config="_config2" &#64;ref="_chart1">&lt;Chart>
60+
</CodeSnippet>
61+
62+
<CodeSnippet Language="Language.csharp" Style="Style.VisualStudio" LoadMainScript="false">
63+
private LineChartConfig? _config2;
64+
private Chart? _chart2;
65+
66+
protected override async Task OnInitializedAsync()
67+
_config2 = new LineChartConfig()
68+
{
69+
Options = new Options()
70+
{
71+
Plugins = new Plugins()
72+
{
73+
Crosshair = new Crosshair()
74+
{
75+
Horizontal = new CrosshairLine()
76+
{
77+
Color = Colors.PaletteBorder1[0]
78+
}
79+
}
80+
}
81+
}
82+
};
83+
84+
_config2.Data.Labels = LineDataExamples.SimpleLineText;
85+
_config2.Data.Datasets.Add(new LineDataset()
86+
{
87+
Label = "My First Dataset",
88+
Data = LineDataExamples.SimpleLine.ToList(),
89+
BorderColor = Colors.PaletteBorder1.FirstOrDefault(),
90+
Tension = 0.1M,
91+
Fill = false
92+
});
93+
}
94+
</CodeSnippet>
95+
96+
<hr />
97+
98+
<h4>Horizontal & Vertical crosshair</h4>
99+
100+
<Chart Config="_config3" @ref="_chart1" Height="400px"></Chart>
101+
102+
<CodeSnippet Language="Language.xml" Style="Style.VisualStudio">
103+
&ltChart Config="_config3" &#64;ref="_chart1">&lt;Chart>
104+
</CodeSnippet>
105+
106+
<CodeSnippet Language="Language.csharp" Style="Style.VisualStudio" LoadMainScript="false">
107+
private LineChartConfig? _config3;
108+
private Chart? _chart3;
109+
110+
protected override async Task OnInitializedAsync()
111+
{
112+
_config3 = new LineChartConfig()
113+
{
114+
Options = new Options()
115+
{
116+
Plugins = new Plugins()
117+
{
118+
Crosshair = new Crosshair()
119+
{
120+
Horizontal = new CrosshairLine()
121+
{
122+
Color = Colors.PaletteBorder1[0]
123+
},
124+
Vertical = new CrosshairLine()
125+
{
126+
Color = Colors.PaletteBorder1[0]
127+
}
128+
}
129+
}
130+
}
131+
};
132+
133+
_config3.Data.Labels = LineDataExamples.SimpleLineText;
134+
_config3.Data.Datasets.Add(new LineDataset()
135+
{
136+
Label = "My First Dataset",
137+
Data = LineDataExamples.SimpleLine.ToList(),
138+
BorderColor = Colors.PaletteBorder1.FirstOrDefault(),
139+
Tension = 0.1M,
140+
Fill = false
141+
});
142+
}
143+
</CodeSnippet>
144+
145+
@code {
146+
private LineChartConfig? _config1;
147+
private LineChartConfig? _config2;
148+
private LineChartConfig? _config3;
149+
150+
private Chart? _chart1;
151+
private Chart? _chart2;
152+
private Chart? _chart3;
153+
154+
protected override async Task OnInitializedAsync()
155+
{
156+
_config1 = new LineChartConfig()
157+
{
158+
Options = new Options()
159+
{
160+
Plugins = new Plugins()
161+
{
162+
Crosshair = new Crosshair()
163+
{
164+
Vertical = new CrosshairLine()
165+
{
166+
Color = Colors.PaletteBorder1[0]
167+
}
168+
}
169+
}
170+
}
171+
};
172+
173+
_config1.Data.Labels = LineDataExamples.SimpleLineText;
174+
_config1.Data.Datasets.Add(new LineDataset()
175+
{
176+
Label = "My First Dataset",
177+
Data = LineDataExamples.SimpleLine.ToList(),
178+
BorderColor = Colors.PaletteBorder1.FirstOrDefault(),
179+
Tension = 0.1M,
180+
Fill = false
181+
});
182+
183+
_config2 = new LineChartConfig()
184+
{
185+
Options = new Options()
186+
{
187+
Plugins = new Plugins()
188+
{
189+
Crosshair = new Crosshair()
190+
{
191+
Horizontal = new CrosshairLine()
192+
{
193+
Color = Colors.PaletteBorder1[0]
194+
}
195+
}
196+
}
197+
}
198+
};
199+
200+
_config2.Data.Labels = LineDataExamples.SimpleLineText;
201+
_config2.Data.Datasets.Add(new LineDataset()
202+
{
203+
Label = "My First Dataset",
204+
Data = LineDataExamples.SimpleLine.ToList(),
205+
BorderColor = Colors.PaletteBorder1.FirstOrDefault(),
206+
Tension = 0.1M,
207+
Fill = false
208+
});
209+
210+
_config3 = new LineChartConfig()
211+
{
212+
Options = new Options()
213+
{
214+
Plugins = new Plugins()
215+
{
216+
Crosshair = new Crosshair()
217+
{
218+
Horizontal = new CrosshairLine()
219+
{
220+
Color = Colors.PaletteBorder1[0]
221+
},
222+
Vertical = new CrosshairLine()
223+
{
224+
Color = Colors.PaletteBorder1[0]
225+
}
226+
}
227+
}
228+
}
229+
};
230+
231+
_config3.Data.Labels = LineDataExamples.SimpleLineText;
232+
_config3.Data.Datasets.Add(new LineDataset()
233+
{
234+
Label = "My First Dataset",
235+
Data = LineDataExamples.SimpleLine.ToList(),
236+
BorderColor = Colors.PaletteBorder1.FirstOrDefault(),
237+
Tension = 0.1M,
238+
Fill = false
239+
});
240+
}
241+
}

ChartjsDemo/Pages/LineSimple.razor

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,6 @@ protected override async Task OnInitializedAsync()
5050
{
5151
_config1 = new LineChartConfig()
5252
{
53-
Options = new Options()
54-
{
55-
Plugins = new Plugins()
56-
{
57-
Crosshair = new Crosshair()
58-
{
59-
Vertical = new CrosshairLine()
60-
{
61-
Color = Colors.PaletteBorder1[0],
62-
}
63-
}
64-
}
65-
}
6653
};
6754

6855
_config1.Data.Labels = LineDataExamples.SimpleLineText;
@@ -75,4 +62,4 @@ protected override async Task OnInitializedAsync()
7562
Fill = false
7663
});
7764
}
78-
}
65+
}

0 commit comments

Comments
 (0)