JOMANJI7
JOMANJI7

Reputation: 61

chart interval property razor

I couldn't find the interval property on (Displaying Data in a Chart with ASP.NET Web Pages (Razor)), even I couldn't set all the labels to be visible.

I'm using following code.

(chart.cshtml)

myChart = new Chart(width: 800, height: 600)
    .AddTitle("Product Sales")
    .AddSeries(
    xValue: datap, xField: "Product",
    yValues: datap, yFields: "Quantity")
    .AddSeries(yValues: dataf, yFields: "Quantity2")

Upvotes: 0

Views: 426

Answers (1)

JOMANJI7
JOMANJI7

Reputation: 61

The Answer Is To Set The Interval Property Value To 1 In Theme Property, And Use That Theme As Chart Theme

I've Used The Following Code:

string theme ="<Chart>\r\n <ChartAreas>\r\n <ChartArea Name=\"Default\" _Template_=\"All\">\r\n <AxisX Interval=\"1\" />\r\n  </ChartArea>\r\n </ChartAreas>\r\n <Legends>\r\n <Legend _Template_=\"All\" Alignment=\"Center\" BackColor=\"Transparent\" Docking=\"Bottom\" Font=\"Trebuchet MS, 8.25pt, style=Bold\" IsTextAutoFit =\"False\" LegendStyle=\"Row\">\r\n </Legend>\r\n </Legends>\r\n <BorderSkin SkinStyle=\"Emboss\" />\r\n</Chart>";

myChart = new Chart(width: 800, height: 600 , theme: theme)
    .AddTitle("Product Sales")
    .AddSeries(
    xValue: datap, xField: "Product",
    yValues: datap, yFields: "Quantity")
    .AddSeries(yValues: dataf, yFields: "Quantity2")

Upvotes: 1

Related Questions