Hi Daniil,
here is a full example to reprodude the problem.
This example produces this:
Please notice I added a tip to show the values : looks like they are wrong... at least not at the right place.
Here is aspx code to reproduce
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication1.WebForm2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Viewport ID="Viewport1" Layout="border" runat="server">
<Items>
<ext:Container ID="Container1" runat="server" Region="Center" Layout="FitLayout">
<LayoutConfig>
<%-- <ext:VBoxLayoutConfig Align="Stretch" DefaultMargins="5 5 5 5" />--%>
<ext:FitLayoutConfig DefaultMargins="5 5 5 5" />
</LayoutConfig>
<Items>
<ext:TabPanel runat="server">
<Items>
<ext:Panel ID="MyTabPanel" runat="server" Title="Demo OK" Layout="FitLayout" Margins="5" UI="Success">
<TabConfig ID="TabConfig2" runat="server" UI="Success" />
</ext:Panel>
<ext:Panel ID="MyTabPanel2" runat="server" Title="Demo KO" Layout="FitLayout" Margins="5" UI="Success">
<TabConfig ID="TabConfig1" runat="server" UI="Danger" />
</ext:Panel>
</Items>
</ext:TabPanel>
</Items>
</ext:Container>
</Items>
</ext:Viewport>
</form>
</body>
</html>
And code behind too:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;
namespace WebApplication1
{
public partial class WebForm2 : System.Web.UI.Page
{
public class Dummy
{
public DateTime dt { get; set; }
public int val1 { get; set; }
public int val2 { get; set; }
public static Ext.Net.Store GetStore()
{
return new Store
{
Model =
{
new Model
{
Fields =
{
new ModelField("dt", ModelFieldType.Date),
new ModelField("val1", ModelFieldType.Int),
new ModelField("val2", ModelFieldType.Int)
}
}
}
};
}
public static Ext.Net.ItemsCollection<Ext.Net.ColumnBase> GetColumns()
{
Ext.Net.ItemsCollection<Ext.Net.ColumnBase> Cols = new ItemsCollection<ColumnBase>
{
new DateColumn
{
Text = "Date",
DataIndex = "dt",
Format="MMM Y",
Flex = 1
},
new Column
{
Text = "Value 1",
DataIndex = "val1"
},
new Column
{
Text = "Value 2",
DataIndex = "val2"
}
};
return Cols;
}
};
protected void Page_Load(object sender, EventArgs e)
{
// creating a dummy store
List<Dummy> mylist = new List<Dummy>();
DateTime baseDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
for (int i = 0; i < 24; i++)
{
mylist.Add(new Dummy()
{
dt = baseDate.AddMonths(-i),
val1 = i,
val2 = (i+1) * 2
});
}
//creating a gridpabnel to see store data
GridPanel gp = new GridPanel()
{
Border = true,
Title = "Working OK",
MarginSpec = "0 0 3 0",
Flex=1,
SelectionModel =
{
new RowSelectionModel() { Mode = SelectionMode.Multi }
},
View =
{
new Ext.Net.GridView()
{
StripeRows = true,
TrackOver = true
}
}
};
//store will be same for gridpanel and graph
Store myStore = Dummy.GetStore();
myStore.ID = "dummyStore";
myStore.DataSource = mylist;
gp.ColumnModel.Add(Dummy.GetColumns());
gp.Store.Add(myStore);
// this.Container1.Items.Add(gp);
gp.AddTo(this.MyTabPanel);
//graph
Chart ch = new Chart()
{
Animate = true,
Shadow = true,
InsetPadding = 10,
Theme = "Base:gradiant",
StoreID = myStore.ID,
LegendConfig = new ChartLegend.Config() { Position = LegendPosition.Bottom },
Legend = true,
};
ColumnSeries ar1 = new ColumnSeries()
{
Tips = new ChartTip(),
Highlight = true,
XField = new string[] { "dt" },
YField = new string[] { "val1","val2" },
Titles = new string[] { "Value 1", "Value 2" },
ShowInLegend = true,
Axis = Ext.Net.Position.Left
};
//added this to see that value is OK
ar1.Tips.UI = UI.Danger;
ar1.Tips.TrackMouse = true;
ar1.Tips.BodyStyle = "text-align:center; font-size:12px;";
ar1.Tips.Renderer.Handler = "this.update( Ext.Date.format(storeItem.get('dt'), 'm Y') + '<hr> Value 1 : ' +storeItem.get('val1') + '<hr>Value 2: ' + storeItem.get('val2'));";
NumericAxis axe1 = new NumericAxis() {
Fields = new string[] { "val1", "val2" },
Position = Ext.Net.Position.Left,
Title = "Euros",
Minimum = 0 };
ch.Axes.Add(axe1);
TimeAxis axe2 = new TimeAxis()
{
Fields = new string[] { "dt" },
Title = "Month",
Position = Ext.Net.Position.Bottom,
DateFormat = "MMM yy",
Grid = false,
StepUnit = DateUnit.Month,
Label = new AxisLabel() {
Rotate = new RotateAttribute() { Degrees = 270 }
},
Step = 1
};
ch.Axes.Add(axe2);
ch.Series.Add(ar1);
Ext.Net.Panel panCA = new Ext.Net.Panel() {
Title = "CA / Marge",
Layout = "FitLayout",
Flex = 1,
MinHeight =300,
Icon = Ext.Net.Icon.ChartBar
};
panCA.Items.Add(ch);
// this.Container1.Items.Add(panCA);
panCA.AddTo(this.MyTabPanel2);
}
}
}
I think the two erros might be linked ...
Thanks for your help