PDA

View Full Version : سوال: رسم نمودار با Highcharts



EBRAHIMIEKOKDARAGHI
جمعه 08 آبان 1394, 10:46 صبح
با سلام خدمت اساتید و دوستان
من یه برنامه داشبورد مدیریت میخوام بنویسم
من تونستم با زاهمایی دوستان نمودار Gauge پیاده ساری کنم و جواب بگیرم اما مشکل من اینکه توی یک ویو باید چند نمودار از این نوع داشته باشم هر کاری کردم نشد لطفا راهنمایی بفرمایید
Controller

public ActionResult Chart_1()
{
Highcharts chart = new Highcharts("chart")
.InitChart(new Chart
{
Type = ChartTypes.Gauge,
PlotBackgroundColor = null,
PlotBackgroundImage = null,
PlotBorderWidth = 0,
PlotShadow = false
})
.SetTitle(new Title { Text = "Speedometer" })
.SetPane(new Pane
{
StartAngle = -150,
EndAngle = 150,
Background = new[]
{
new BackgroundObject
{
BackgroundColor = new BackColorOrGradient(new Gradient
{
LinearGradient = new[] { 0, 0, 0, 1 },
Stops = new object[,] { { 0, "#FFF" }, { 1, "#333" } }
}),
BorderWidth = new PercentageOrPixel(0),
OuterRadius = new PercentageOrPixel(109, true)
},
new BackgroundObject
{
BackgroundColor = new BackColorOrGradient(new Gradient
{
LinearGradient = new[] { 0, 0, 0, 1 },
Stops = new object[,] { { 0, "#333" }, { 1, "#FFF" } }
}),
BorderWidth = new PercentageOrPixel(1),
OuterRadius = new PercentageOrPixel(107, true)
},
new BackgroundObject(),
new BackgroundObject
{
BackgroundColor = new BackColorOrGradient(ColorTranslator.FromHtml("#DDD")),
BorderWidth = new PercentageOrPixel(0),
OuterRadius = new PercentageOrPixel(105, true),
InnerRadius = new PercentageOrPixel(103, true)
}
}
})
.SetYAxis(new YAxis
{
Min = 0,
Max = 200,

//MinorTickInterval = "auto",
MinorTickWidth = 1,
MinorTickLength = 10,
MinorTickPosition = TickPositions.Inside,
MinorTickColor = ColorTranslator.FromHtml("#666"),
TickPixelInterval = 30,
TickWidth = 2,
TickPosition = TickPositions.Inside,
TickLength = 10,
TickColor = ColorTranslator.FromHtml("#666"),
Labels = new YAxisLabels
{
Step = 2,
//Rotation = "auto"
},
Title = new YAxisTitle { Text = "km/h" },
PlotBands = new[]
{
new YAxisPlotBands { From = 0, To = 120, Color = ColorTranslator.FromHtml("#55BF3B") },
new YAxisPlotBands { From = 120, To = 160, Color = ColorTranslator.FromHtml("#DDDF0D") },
new YAxisPlotBands { From = 160, To = 200, Color = ColorTranslator.FromHtml("#DF5353") }
}
})
.SetSeries(new Series
{
Name = "Speed",
Data = new Data(new object[] { 100 } )

}

);

return View(chart);
}


View

@model DotNet.Highcharts.Highcharts
@{
ViewBag.Title = "Chart_1";
Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Chart_1</h2>

@(Model)

EBRAHIMIEKOKDARAGHI
سه شنبه 12 آبان 1394, 11:13 صبح
یعنی کسی این کار رو نکرده ؟
لطفا"گه میتونید راهنمایی کنید ضروریه !!!