PDA

View Full Version : [CLOSED] Line chart with data labels



jchau
Sep 23, 2013, 6:57 PM
Do you have an example of a line chart with data labels? I believe over a year ago, there was a bug with line charts and data labels. I am hoping it's fixed now in latest version. I created a simple example but can't get the labels to show up correctly.

Daniil
Sep 24, 2013, 3:48 AM
Hi @jchau,

Here is a very basic example with labels.

Example

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Store s = this.Chart1.GetStore();
s.DataSource = new object[]
{
new
{
x = 0,
y = 0
},
new
{
x = 50,
y = 50
},
new
{
x = 100,
y = 100
}
};
}
}
</script>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:Chart
ID="Chart1"
runat="server"
Width="400"
Height="400">
<Store>
<ext:Store runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="x" />
<ext:ModelField Name="y" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<Axes>
<ext:NumericAxis Title="X" Fields="x" Position="Bottom" />
<ext:NumericAxis Title="Y" Fields="y" Position="Left" />
</Axes>
<Series>
<ext:LineSeries Titles="Chart" XField="x" YField="y">
<Label Field="x" Display="Rotate" />
</ext:LineSeries>
</Series>
</ext:Chart>
</form>
</body>
</html>

Though, the bug with positioning of labels is still open.
http://www.sencha.com/forum/showthread.php?188384
http://www.sencha.com/forum/showthread.php?242791

Here is a related Issue.
https://github.com/extnet/Ext.NET/issues/150