前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >VisiFire示例

VisiFire示例

作者头像
全栈程序员站长
发布2022-09-13 18:52:29
3240
发布2022-09-13 18:52:29
举报

大家好,又见面了,我是你们的朋友全栈君。

VisiFire示例
VisiFire示例

Syntax:

<vc:Chart … >

<vc:Chart.Series>

<vc:DataSeries>

<vc:DataSeries.DataPoints>

<vc:DataPoint LabelText=”#AxisXLabel, #YValue” />

</vc:DataSeries.DataPoints>

</vc:DataSeries>

</vc:Chart.Series>

</vc:Chart>

Below is the chart after setting LabelText property:

Modifiers:

Modifier

Description

#AxisXLabel

Returns the axis label value if axis labels is present for that XValue. Otherwise returns XValue.

#Percentage

Returns the percentage value with respect to DataPoints in that series.

#Series

Returns the series name.

#Sum

Returns sum of values in entire chart with same XValue. (Used for stacked charts only)

#XValue

Returns XValue.

#YValue

Returns YValue.

#ZValue

Returns ZValue.

#Open

Returns Open value.

#Close

Returns Close value.

#High

Returns High value.

#Low

Returns Low value.

Remarks:

  1. The above modifiers are applicable for LabelText set in DataPoint or DataSeries only.
  2. Modifiers can be used in any combination to display DataPoint specific content.
  3. To display the modifier itself use the ‘#’ twice. For example to display “#XValue” as label use LabelText=”##XValue”
  4. The default value for LabelText in Pie/Doughnut and Funnel charts is “AxisXLabel, #YValue”.
  5. The default value for LabelText in CandleStick and Stock charts is “#Close”.
  6. The default value for LabelText in all other charts is “#YValue”.
  7. For CandleStick and Stock charts, LabelText can be set as LabelText=”#Open, #Close, #High, #Low, #YValue”. For CandleStick and Stock charts, volume information can be stored in YValue property and can be showed as a LabelText for DataPoints. Note that YValue property is not being used in CandleStick and Stock charts.
  8. For Stacked charts, percentage will be calculated from the DataPoints present in each XValue. In other words, percentage will be calculated for stacked DataPoints (in each XValue) from all series.
  9. For CandleStick and Stock charts, percentage will be calculated for Closing price in DataPoints.

示例:

Chart chart = new Chart(); chart.ScrollingEnabled = true; chart.View3D = false;

Title title = new Title(); title.Text = Title+”血型统计(按月分组)”; chart.Titles.Add(title);

Axis axis = new Axis(); axis.IntervalType = IntervalTypes.Number; axis.Suffix = “月”; axis.Interval = 1; axis.Title = “血型”; chart.AxesX.Add(axis);

Axis yaxis = new Axis(); yaxis.Enabled = true; // 坐标轴类型,可以是primary或secondary,这个属性只能用于Y轴,只有在设置了DataSeries的AxisYType属性后才会启用 yaxis.AxisType = AxisTypes.Primary; chart.AxesY.Add(yaxis);

//血型总共5个种类:A,B,AB,O,未知 string[] bloodType = new string[5] { “A”, “B”, “AB”, “O”, “未知” }; int[] months = new int[12] {1,2,3,4,5,6,7,8,9,10,11,12}; for (Int32 j = 0; j < bloodType.Length; j++) { DataSeries dataSeries = new DataSeries();

string blood=bloodType[j]; dataSeries.Name = blood; dataSeries.RenderAs = RenderAs.Column; dataSeries.ShowInLegend = true; dataSeries.XValueType = ChartValueTypes.Numeric; dataSeries.ToolTipText = “#Series型血,袋数:#YValue,#AxisXLabel”;

DataPoint dataPoint; for (int i = 0; i < months.Length; i++) { dataPoint = new DataPoint(); int month = months[i]; dataPoint.XValue = month;

int count = 0; if (j == 4) { count = list.Where(a => string.IsNullOrWhiteSpace(a.BloodType) && a.FiltrDate.Month.Equals(month)).Count(); } else { count = list.Where(a => a.BloodType == blood && a.FiltrDate.Month.Equals(month)).Count(); }

if (count > 0) { dataPoint.LabelEnabled = true; dataPoint.LabelStyle = LabelStyles.OutSide; } else { dataPoint.LabelEnabled = false; } dataPoint.YValue=count;

dataSeries.DataPoints.Add(dataPoint); }

chart.Series.Add(dataSeries); } BloodChart.Children.Add(chart);

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/162776.html原文链接:https://javaforall.cn

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档