Apr 23, 2012, 2:58 PM
[CLOSED] Set actionMethods of AJAXProxy
Hi,
I have the code below to load data of the chart from a remote data source. It is developed in asp.net mvc3 + razor view engine.
It is working fine, but the only problem is that the data is loaded through GET not POST. I am sure that the ajaxproxy has a actionmethods property, but I am not sure how to set the value of the property. Any help is appreciated.
I have the code below to load data of the chart from a remote data source. It is developed in asp.net mvc3 + razor view engine.
It is working fine, but the only problem is that the data is loaded through GET not POST. I am sure that the ajaxproxy has a actionmethods property, but I am not sure how to set the value of the property. Any help is appreciated.
@Html.X().Panel().Title("Area Chart").Width(800).Height(600).Layout("FitLayout").TopBar(topBar => topBar.Add(Html.X().Toolbar().Items(items =>
{
items.Add(Html.X().Button().Text("Reload Data").Icon(Icon.ArrowRefresh).Listeners(listener =>
{ listener.Click.Handler = "#{Store1}.reload();"; }));
items.Add(Html.X().Button().Text("Animate").Icon(Icon.ShapesManySelect).EnableToggle(true).Pressed(true).Listeners(listeners =>
{
listeners.Toggle.Handler = "#{Chart1}.animate = pressed ? {easing: 'ease', duration: 500} : false;";
}));
}))).Items(items =>
{
items.Add(Html.X().Chart().ID("Chart1").StyleSpec("background: #fff").Legend(true).Animate(true).Store(store => store.Add(Html.X().Store().ID("Store1").Model(model => model.Add(Html.X().Model().Fields(fields =>
{
fields.Add(Html.X().ModelField().Name("Name"));
fields.Add(Html.X().ModelField().Name("Data1"));
fields.Add(Html.X().ModelField().Name("Data2"));
fields.Add(Html.X().ModelField().Name("Data3"));
fields.Add(Html.X().ModelField().Name("Data4"));
fields.Add(Html.X().ModelField().Name("Data5"));
fields.Add(Html.X().ModelField().Name("Data6"));
fields.Add(Html.X().ModelField().Name("Data7"));
}))).Proxy(proxy => proxy.Add(Html.X().AjaxProxy().Url(Url.Action("GetData","Home")).Reader(reader => reader.Add(
Html.X().JsonReader().Root("data")
)))))).Axes(axes =>
{
axes.Add(Html.X().NumericAxis().Fields(new string[] {"Data1", "Data2", "Data3", "Data4", "Data5", "Data6", "Data7"}).Title("Number of Hits").Minimum(0).GridConfig(new AxisGrid() { Odd = new SpriteAttributes() {Opacity = 1, Fill = "#ddd", Stroke = "#fff", StrokeWidth = 1}}));
axes.Add(Html.X().CategoryAxis().Position(Position.Bottom).Fields(new string[]{"Name"}).Title("Month of the Year").Grid(true).Label(new AxisLabel() { Rotate = new RotateAttribute() {Degrees = 315}}));
}).Series(series => series.Add(Html.X().AreaSeries().Axis(Position.Right).XField(new string[] {"Name"}).YField(new string[] {"Data1", "Data2", "Data3", "Data4", "Data5", "Data6", "Data7"}).Style(new SpriteAttributes() {Opacity = 0.93}))));
})
Last edited by Daniil; Apr 25, 2012 at 9:54 PM.
Reason: [CLOSED]