PDA

View Full Version : [CLOSED] All the values are not getting plot on Numeric Axis in Chart



PriceRightHTML5team
Apr 15, 2014, 6:51 AM
Hi,

I have bar chart which is rendering correctly, but some value are not getting plot on NumericAxis, i have set the Degree of numeric axis to 315 and as per my requirement i don't want to change the degree.
I am also facing this issue in Line Chart as well.

Here is the snapshot of the graph

9931

Here is my sample code:

//Model



public class ChartModel
{
public string Name { get; set; }
public int Data1 { get; set; }
}


// Controller




public StoreResult GenerateNPVData()
{
List<ChartModel> lst = new List<ChartModel>();
ChartModel cm = new ChartModel();
cm = new ChartModel();
cm.Name = "Scenario Series - 1";
cm.Data1 = 3500;
lst.Add(cm);

cm = new ChartModel();
cm.Name = "Scenario Series - 2";
cm.Data1 = 5500;
lst.Add(cm);
return new StoreResult(lst);
}

public ActionResult NPVBarChar()
{
return View();
}



// View





@{
ViewBag.Title = "Bar Chart";
var X = Html.X();
}

@(Html.X().ResourceManager(ViewBag.ManagerConfig as MvcResourceManagerConfig))

@{
<h3>Bar Chart Sample</h3><br />



@(X.Panel()
.Title("Column Chart")
.Layout(LayoutType.Fit)
.Width(310)
.Height(210)
.Items(
X.Chart()
.ID("Chart1")
.Width(300)
.Height(200)
.Shadow(true)
.StyleSpec("background:#fff;")
.Animate(true)
.Store(X.Store()
.Data(Model)
.Model(X.Model()
.Fields(
X.ModelField().Name("Name"),
X.ModelField().Name("Data1")
)
)
.Proxy(X.AjaxProxy()
.Url(Url.Action("GenerateNPVData"))
.Reader(X.JsonReader().Root("data"))
)
)
.Axes(
X.NumericAxis()
.Fields("Data1")
.Position(Position.Bottom)
.Grid(true)
.Minimum(0)
.Title("Revenue")
.Label(X.AxisLabel().Rotate(X.RotateAttribute().De grees(315))
.Renderer(r => r.Handler = "return Ext.util.Format.number(value, '0,0');")
),
X.CategoryAxis()
.Position(Position.Left)
.Fields("Name")
.Title("Scenario")
.Label(X.AxisLabel()
.Rotate(X.RotateAttribute().Degrees(0))
)

)
.Series(X.BarSeries()
.Axis(Position.Left)
.Highlight(true)
.XField("Name")
.YField("Data1")
.Tips(X.ChartTip()
.TrackMouse(true)
.Width(140)
.Height(28)
.Renderer(r => r.Handler = "this.setTitle(storeItem.get('Name') + ': ' + storeItem.get('Data1'));")
)
.Label(X.SeriesLabel()
.Display(SeriesLabelDisplay.InsideEnd)
.Field(new [] { "Data1" })
.Orientation(Orientation.Horizontal)
.Color("#333")
.TextAnchor("middle")
.Renderer(r => r.Handler = "return Ext.util.Format.number(value, '0');")
)
)
)
)
}




So can you please provide the solution for this issue?

Thanks

Daniil
Apr 15, 2014, 4:54 PM
Hi @PriceRightHTML5team,

Please try to increase the Chart's Width.