Asp NET system.web.helpers مخطط دائري

برمجة


أحاول استبدال MSCHART من مشاريعي بمساعدي المخططات (System.Web.Helpers) ولكني أواجه الكثير من الصعوبات:

1) كيف يمكنني إدراج قيم النسبة المئوية في مخطط PIE؟
2) هل يمكنني نقل قيمة المخطط خارج الفطيرة؟

ما حاولت:

ج#
Chart myChart = new Chart(width: 800, height: 400, themePath: "~/xml/hst_pie_tech.xml",  theme: ChartTheme.Vanilla3D)
           .AddTitle("Volume ")
           .AddSeries("Volume",
                   chartType: "Pie",
                   xValue: dataView, xField: "Technology",
                   yValues: dataView, yFields: "Qty",
                   markerStep: 1

                   );
XML
<?xml version="1.0" encoding="utf-8" ?>
<Chart>
	
	<ChartAreas>

		<ChartArea Name="Default" _Template_="All">
			<AxisY
				LineColor="0, 0, 0"
				TitleFont="{0}, 14pt, style=Bold"
				TitleForeColor="0, 0, 0"
				
				>
				<LabelStyle Font="{0}, 6.75pt, GdiCharSet=0" ForeColor="0, 0, 0" />
			</AxisY>
			
			<AxisX 
				Interval="1"
				TitleFont="{0}, 18pt, GdiCharSet=0"	>
				
				<LabelStyle Font="{0}, 6.75pt, GdiCharSet=0" ForeColor="0, 0, 0" />
			</AxisX>
			
		</ChartArea>

	</ChartAreas>
	
	<Titles>
		<Title _Template_="All" Font="{0}, 14pt, style=Bold" ForeColor="0, 0, 0"></Title>
	</Titles>
		
	<Series>
		<Series 
			Name="Volume" 
			BorderWidth="2" 
			Color="153, 204, 255" 
			BorderColor="164, 164, 164" 
			BorderDashStyle="Solid" 
			ShadowColor="128, 128, 128, 128" 
			ShadowOffset="1" 
			IsValueShownAsLabel="true" 
			Font="{0}, 8pt" 
			BackGradientStyle="TopBottom" 
			BackSecondaryColor="0, 102, 153" 
			LabelForeColor="0, 0, 0"
			
			>
			<SmartLabelStyle Enabled="True" />
		</Series>
	</Series>
	
	<Legends>
		<Legend Alignment="Center" Docking="Left" Name="Technology" Font="{0}, 10pt, style=Italic, GdiCharSet=0">
	</Legend>
	</Legends>

	<BorderSkin PageColor="Control" BackColor="CornflowerBlue" BackSecondaryColor="CornflowerBlue" />
</Chart>

الحل 1

إذا كنت تريد استخدام النسب المئوية كأرقام، فما عليك سوى تعيين القيم للسلسلة. فهي مجرد أرقام بعد كل شيء. إذا كان ما تسأل عنه هو كيفية إظهار النسبة المئوية كتسمية، فما عليك سوى استخدام هذا الترميز مقابل منطقة الرسم البياني الخاصة بك.

لغة البرمجة
<AxisY >
  <LabelStyle Format="{0:p}" />
</AxisY>

コメント

タイトルとURLをコピーしました