[FIXED] [#151] Y-Axis auto scale doesn't work for values less than 1 (percentage values)

Page 1 of 2 12 LastLast
  1. #1

    [FIXED] [#151] Y-Axis auto scale doesn't work for values less than 1 (percentage values)

    If I bind values that are less than 1 to the chart store, it doesn't auto scale the numeric axis. These are percentage values. In example below, the minimum should not be 0. It should be around 60% or so.

    <script runat="server">
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Me.ResourceManager1.RegisterIcon(Ext.Net.Icon.Disk)
     
            If Not IsPostBack Then
                Dim data As New List(Of Object)
                
                data.Add(New With {.XField = "Jan", .Value = 0.75})
                data.Add(New With {.XField = "Feb", .Value = 0.8})
                data.Add(New With {.XField = "Mar", .Value = 0.85})
                data.Add(New With {.XField = "Apr", .Value = 0.9})
                data.Add(New With {.XField = "May", .Value = 0.8})
                data.Add(New With {.XField = "Jun", .Value = 0.75})
                data.Add(New With {.XField = "Jul", .Value = 0.85})
                
                Me.store.DataSource = data
                Me.store.DataBind()
                
            End If
        End Sub
        
    
    
        
    </script>
    <!DOCTYPE html>
    <html>
    <head id="Head1" runat="server">
    </head>
    <body>
        <script type="text/javascript">
    
    
        </script>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" ScriptMode="Debug" Theme="Gray"
            DisableViewState="true" />
        <ext:Panel runat="server" Title="Chart" Width="400" Height="400" Layout="FitLayout">
            <Items>
                <ext:Chart runat="server">
                    <Axes>
                        <ext:NumericAxis Position="Left" Fields="Value">
                            <Label>
                                <Renderer Handler="return Ext.util.Format.number(value * 100, '0') + '%' ;">
                                </Renderer>
                            </Label>
                        </ext:NumericAxis>
                        <ext:CategoryAxis Position="Bottom" Fields="XField">
                        </ext:CategoryAxis>
                    </Axes>
                    <Series>
                        <ext:LineSeries XField="XField" YField="Value">
                        </ext:LineSeries>
                    </Series>
                    <Store>
                        <ext:Store runat="server" ID="store">
                            <Model>
                                <ext:Model runat="server">
                                    <Fields>
                                        <ext:ModelField Name="XField">
                                        </ext:ModelField>
                                        <ext:ModelField Name="Value">
                                        </ext:ModelField>
                                    </Fields>
                                </ext:Model>
                            </Model>
                        </ext:Store>
                    </Store>
                </ext:Chart>
            </Items>
        </ext:Panel>
        </form>
    </body>
    </html>
    Last edited by Daniil; Feb 18, 2013 at 11:38 AM. Reason: [OPEN] [#151]
  2. #2
    Hello!

    Can you say what Ext.NET version are you using?

    I've tried with trunk and everything looks good: Click image for larger version. 

Name:	chart.JPG 
Views:	131 
Size:	21.0 KB 
ID:	5632
  3. #3
    Quote Originally Posted by Baidaly View Post
    Hello!

    Can you say what Ext.NET version are you using?

    I've tried with trunk and everything looks good: Click image for larger version. 

Name:	chart.JPG 
Views:	131 
Size:	21.0 KB 
ID:	5632
    Y-axis should not start at 0 if scaled correctly. It should start at 60% instead.
  4. #4
    Click image for larger version. 

Name:	chart.png 
Views:	140 
Size:	15.4 KB 
ID:	5633

    it should look something like above instead.
  5. #5
    Thank you for the clarifications.

    Try to set minimum value for Y-Axis:

    <ext:NumericAxis Position="Left" Fields="Value" Minimum="0.70">
    	<Label>
    		<Renderer Handler="return Ext.util.Format.number(value * 100, '0') + '%' ;">
    		</Renderer>
    	</Label>
    </ext:NumericAxis>
    Click image for larger version. 

Name:	chart.JPG 
Views:	99 
Size:	20.0 KB 
ID:	5634
  6. #6
    That wont be possible since I have no idea what the minimum should be at design time. The data is dynamic. The chart should be able to figure out the minimum and maximum based on the data in the store. I believe this is a bug.
  7. #7
    Hello,

    Agree, it looks a bug. I reported to Sencha.
    http://www.sencha.com/forum/showthread.php?256685
  8. #8
    Temporarily try the following handler:

    <ext:Store runat="server" ID="store">
    	<Model>
    		<ext:Model runat="server">
    			<Fields>
    				<ext:ModelField Name="XField">
    				</ext:ModelField>
    				<ext:ModelField Name="Value">
    				</ext:ModelField>
    			</Fields>
    		</ext:Model>
    	</Model>
    	<Listeners>
    		<Load Handler="
    		var min = null; 
    		records.forEach(function(item) { 
    			if (min == null || min > item.data.Value) min = item.data.Value; 
    		}); 
    		#{Chart1}.axes.items[0].minimum = min;
    		#{Chart1}.redraw();"></Load>
    	</Listeners>
    </ext:Store>
  9. #9
    We created an Issue to monitor this defect.
    https://github.com/extnet/Ext.NET/issues/151

    Sencha has not opened the bug yet, but, probably, they will do it.
  10. #10
    Sencha opened a bug ticket.
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Line Series Chart with null values & axis scaling
    By tylert in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 25, 2014, 6:57 AM
  2. Replies: 1
    Last Post: May 13, 2014, 4:09 PM
  3. [CLOSED] Adding a 0 x-axis to chart with negative values
    By jchau in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 13, 2014, 4:06 PM
  4. [CLOSED] Bar Chart overlapping the Category Axis when there are only negative values
    By PriceRightHTML5team in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 18, 2014, 4:21 AM
  5. [CLOSED] All the values are not getting plot on Numeric Axis in Chart
    By PriceRightHTML5team in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 15, 2014, 3:54 PM

Posting Permissions