本文整理汇总了C#中DotNet.Highcharts.Highcharts.SetTooltip方法的典型用法代码示例。如果您正苦于以下问题:C# Highcharts.SetTooltip方法的具体用法?C# Highcharts.SetTooltip怎么用?C# Highcharts.SetTooltip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNet.Highcharts.Highcharts
的用法示例。
在下文中一共展示了Highcharts.SetTooltip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Index
//
// GET: /HighChartsSampleModel/
public ActionResult Index()
{
var highchartSample = new List<HighChartsSampleModel>
{
new HighChartsSampleModel() {Parameters = "Event", GoodScore = 23.45D, AverageScore = 15.32D,BadScore = 9.4D,ActualScore=78.33D},
new HighChartsSampleModel() {Parameters = "Weather",GoodScore=45.67D,AverageScore = 33.24D,BadScore = 12.23D,ActualScore = 56.22D},
new HighChartsSampleModel() {Parameters = "User Review",GoodScore=67.23D,AverageScore = 31.23D,BadScore = 10.11D,ActualScore = 29.44D},
new HighChartsSampleModel() {Parameters = "Tweets",GoodScore = 89.67D,AverageScore = 12.33D,BadScore = 3.43D,ActualScore = 88.11D},
new HighChartsSampleModel() {Parameters = "Persona",GoodScore=38.34D,AverageScore = 25.34D,BadScore = 16.43D,ActualScore = 35.08D},
new HighChartsSampleModel() {Parameters = "Crime",GoodScore=38.34D,AverageScore = 25.34D,BadScore = 16.43D,ActualScore = 24.87D}
};
var xDataParameters = highchartSample.Select(i => i.Parameters).ToArray();
var actualScore = highchartSample.Select(i => i.ActualScore);
var chart = new Highcharts("chart");
chart.InitChart(new Chart { DefaultSeriesType = ChartTypes.Bar });
chart.SetTitle(new Title { Text = "Risk Score Profiling" });
chart.SetSubtitle(new Subtitle { Text = "Risk predicting using social media" });
chart.SetXAxis(new XAxis { Categories = xDataParameters });
chart.SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Scores" }, Max = 100 });
chart.SetLegend(new Legend { Enabled = false, });
chart.SetTooltip(new Tooltip
{
Enabled = true,
Formatter = @"function(){return '<b>' + this.series.name +'</b><br/>' + this.x+':' + this.y;}"
});
chart.SetPlotOptions(new PlotOptions
{
//Series = new PlotOptionsSeries() { Stacking = Stackings.Normal },
Bar = new PlotOptionsBar
{
DataLabels = new PlotOptionsBarDataLabels { Enabled = true,Color = Color.Maroon,Shadow = true},
//PointWidth = 10,
//GroupPadding = 1,
//PointPadding = 0,
Shadow = true,
BorderWidth = 1,
BorderColor = Color.FloralWhite,
}
});
Data data = new Data(
actualScore.Select(y => new Point { Color = GetBarColor(y), Y = y}).ToArray()
);
chart.SetSeries(new Series { Name = "Actual Score", Data = data });
return View(chart);
}
示例2: CurrentMonthGoalProgressNet
public string CurrentMonthGoalProgressNet()
{
var now = DateTime.Now;
var daysInMonth = DateTime.DaysInMonth(now.Year, now.Month);
var expectedPct = ((decimal)now.Day / daysInMonth);
var remainingDays = daysInMonth - now.Day;
var stepsPR = pedometerCalcService.StepsPR();
var remainingSteps = (int) (stepsPR-pedometerCalcService.MonthStepsActual())/remainingDays;
var highchart = new Highcharts("CurrentMonthGoal");
var chart = new Chart() {Type = ChartTypes.Bar};
var categories = new List<string> {"Steps"};
var yaxis = new YAxis {Max = 1};
var seriesArray = new List<Series>();
var series = new Series {Name = "Expected",Color = Color.Red};
var data = new List<object> {pedometerCalcService.MonthPctExpected(now)};
var plotoptions = new PlotOptionsBar
{
Grouping = false,
Shadow = false,
DataLabels = new PlotOptionsBarDataLabels()
{
Enabled = false,
Format = string.Format("Expected: {0}", (int) (stepsPR*expectedPct)),
Color = Color.White
}
};
series.Data = new Data(data.ToArray());
series.PlotOptionsBar = plotoptions;
seriesArray.Add(series);
series = new Series {Name = "Actual", Color = Color.Green};
data = new List<object> { pedometerCalcService.MonthPct(now.Month, now.Year) };
plotoptions = new PlotOptionsBar
{
Grouping = false,
Shadow = false,
DataLabels = new PlotOptionsBarDataLabels()
{
Enabled = true,
Format = string.Format("Remaining: {0}/day", remainingSteps),
Color = Color.White,
Shadow = false
}
};
series.Data = new Data(data.ToArray());
series.PlotOptionsBar = plotoptions;
seriesArray.Add(series);
highchart.InitChart(chart);
highchart.SetTitle(new Title() {Text = "Month Progress"});
highchart.SetXAxis(new XAxis() {Categories = categories.ToArray()});
highchart.SetYAxis(yaxis);
highchart.SetSeries(seriesArray.ToArray());
highchart.SetTooltip(new Tooltip() {Enabled = false});
return highchart.ToHtmlString();
}
示例3: WeightYearProgressNet
public string WeightYearProgressNet()
{
var startWeight = pedometerCalcService.GetStartWeight(DateTime.Now.Year);
const int goalWeight = 144;
var currentWeight = pedometerCalcService.GetRecentWeight();
var goalLoss = startWeight - goalWeight;
var actualLoss = Math.Round(startWeight - currentWeight, 1);
var expectedPct = (DateTime.Now.DayOfYear / 365.0);
var expectedLoss = Math.Round(expectedPct * goalLoss, 1);
var highchart = new Highcharts("weightloss");
var chart = new Chart()
{
Type = ChartTypes.Gauge
};
highchart.InitChart(chart);
highchart.SetTitle(new Title{Text = "Weight Loss " + Math.Round(currentWeight,1)});
var series = new Series {Data = new Data(new object[] {actualLoss})};
highchart.SetSeries(series);
var pane = new Pane
{
Background = new[]
{
new BackgroundObject
{
InnerRadius = new PercentageOrPixel(60, true),
OuterRadius = new PercentageOrPixel(100, true)
}
},
StartAngle = 0,
EndAngle = 360
};
highchart.SetPane(pane);
var yaxis = new YAxis
{
Min = 0,
Max = goalLoss,
PlotBands = new[]
{
new YAxisPlotBands { From = 0, To = expectedLoss, Color = Color.Red },
new YAxisPlotBands { From = expectedLoss, To = expectedLoss+0.7, Color = Color.Yellow },
new YAxisPlotBands { From = expectedLoss+0.7, To = goalLoss, Color = Color.Green }
},
Labels = new YAxisLabels() { Style = "color:'black'"}
};
highchart.SetYAxis(yaxis);
highchart.SetTooltip(new Tooltip() {Enabled = false});
highchart.SetSubtitle(new Subtitle()
{
Text = string.Format("Actual: {0} | Expected: {1} | Difference: {2}", actualLoss, expectedLoss, actualLoss-expectedLoss)
});
highchart.SetLegend(new Legend() {Enabled = false});
return highchart.ToHtmlString();
}