8292a3e4fc91717ed98c43d3beb97a59498bfccf
FAQ/How-do-I-set-only-one-Y-axis-in-a-chart.md
| ... | ... | @@ -0,0 +1,40 @@ |
| 1 | +#How do I set only one Y axis in a chart? |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +##Purpose |
|
| 6 | + |
|
| 7 | +By default, Izenda charts will display two or more y axes on a chart if multiple plotted items have different ranges. This is to prevent very high values from making lower values unreadably small on the chart, and allow for proportional comparison. |
|
| 8 | + |
|
| 9 | +If you would like to override this feature and display only one chart, you can use the following code: |
|
| 10 | + |
|
| 11 | +###C# |
|
| 12 | +```csharp |
|
| 13 | +public override void CustomizeDundasChart(object chart, Hashtable properties, Type chartType) |
|
| 14 | +{ |
|
| 15 | + if (chartType.FullName != "Izenda.AdHoc.DundasBarChart") |
|
| 16 | + return; |
|
| 17 | + Dundas.Charting.WebControl.Chart dchart = chart as Dundas.Charting.WebControl.Chart; |
|
| 18 | + if (dchart == null) |
|
| 19 | + return; |
|
| 20 | + |
|
| 21 | + if (dchart.Series.Count > 1) |
|
| 22 | + dchart.Series[1].YAxisType = Dundas.Charting.WebControl.AxisType.Primary; |
|
| 23 | +} |
|
| 24 | +``` |
|
| 25 | +###VB |
|
| 26 | +```visualbasic |
|
| 27 | +Public Overrides Sub CustomizeDundasChart(chart As Object, properties As Hashtable, chartType As Type) |
|
| 28 | + If chartType.FullName <> "Izenda.AdHoc.DundasBarChart" Then |
|
| 29 | + Return |
|
| 30 | + End If |
|
| 31 | + Dim dchart As Dundas.Charting.WebControl.Chart = TryCast(chart, Dundas.Charting.WebControl.Chart) |
|
| 32 | + If dchart Is Nothing Then |
|
| 33 | + Return |
|
| 34 | + End If |
|
| 35 | + |
|
| 36 | + If dchart.Series.Count > 1 Then |
|
| 37 | + dchart.Series(1).YAxisType = Dundas.Charting.WebControl.AxisType.Primary |
|
| 38 | + End If |
|
| 39 | +End Sub |
|
| 40 | +``` |
|
| ... | ... | \ No newline at end of file |