استخدام خطوط المؤشرات والإعدادات تنسيق ثلاثي الأبعاد
باستخدام خطوط سباركلينز
Microsoft يمكن لبرنامج Excel 2010 تحليل المعلومات بطرق أكثر من أي وقت مضى. يسمح للمستخدمين بتتبع اتجاهات البيانات المهمة وإبرازها باستخدام أدوات تحليل وتصور جديدة للبيانات. خطوط المؤشر هي مخططات مصغرة يمكنك وضعها داخل الخلايا بحيث يمكنك عرض البيانات والمخطط على نفس الجدول. عندما يتم استخدام خطوط المؤشرات بشكل صحيح ، يكون تحليل البيانات أسرع وأكثر دقة. كما أنها توفر عرضًا بسيطًا للمعلومات ، وتجنب أوراق العمل المزدحمة بالكثير من المخططات المزدحمة.
يوفر Aspose.Cells API لمعالجة خطوط المؤشرات في جداول البيانات.
خطوط سباركلينز في Microsoft Excel
لإدراج خطوط مؤشر في Microsoft Excel 2010:
- حدد الخلايا التي تريد ظهور خطوط المؤشر فيها. لتسهيل عرضها ، حدد الخلايا الموجودة بجانب البيانات.
- انقرإدراج على الشريط ثم اخترعمود في السباركلينز مجموعة.
- حدد أو أدخل نطاق الخلايا في ورقة العمل التي تحتوي على البيانات المصدر. سوف تظهر الرسوم البيانية.
تساعدك Sparklines على رؤية الاتجاهات ، على سبيل المثال ، سجل الفوز أو الخسارة لدوري الكرة اللينة. يمكن أن تلخص Sparklines الموسم بأكمله لكل فريق في الدوري.
خطوط الشرارة باستخدام Aspose.Cells
يمكن للمطورين إنشاء خطوط مؤشر أو حذفها أو قراءتها (في ملف القالب) باستخدام API المقدم بواسطة Aspose.Cells. وترد الفئات التي تدير خطوط المؤشرات فيAspose.Cells.Chartsمساحة الاسم لذلك تحتاج إلى استيراد مساحة الاسم هذه قبل استخدام هذه الميزات.
من خلال إضافة رسومات مخصصة لنطاق بيانات معين ، يتمتع المطورون بحرية إضافة أنواع مختلفة من المخططات الصغيرة إلى مناطق الخلايا المحددة.
يوضح المثال أدناه ميزة Sparklines. يوضح المثال كيفية:
- افتح ملف قالب بسيط.
- اقرأ معلومات خطوط المؤشرات لورقة عمل.
- أضف خطوط مؤشرات جديدة لنطاق بيانات معين إلى منطقة خلية.
- احفظ ملف Excel على القرص.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Instantiate a Workbook | |
// Open a template file | |
Workbook book = new Workbook(dataDir + "Book1.xlsx"); | |
// Get the first worksheet | |
Worksheet sheet = book.Worksheets[0]; | |
// Use the following lines if you need to read the Sparklines | |
// Read the Sparklines from the template file (if it has) | |
foreach (SparklineGroup g in sheet.SparklineGroups) | |
{ | |
// Display the Sparklines group information e.g type, number of sparklines items | |
Console.WriteLine("sparkline group: type:" + g.Type + ", sparkline items count:" + g.Sparklines.Count); | |
foreach (Sparkline s in g.Sparklines) | |
{ | |
// Display the individual Sparkines and the data ranges | |
Console.WriteLine("sparkline: row:" + s.Row + ", col:" + s.Column + ", dataRange:" + s.DataRange); | |
} | |
} | |
// Add Sparklines | |
// Define the CellArea D2:D10 | |
CellArea ca = new CellArea(); | |
ca.StartColumn = 4; | |
ca.EndColumn = 4; | |
ca.StartRow = 1; | |
ca.EndRow = 7; | |
// Add new Sparklines for a data range to a cell area | |
int idx = sheet.SparklineGroups.Add(SparklineType.Column, "Sheet1!B2:D8", false, ca); | |
SparklineGroup group = sheet.SparklineGroups[idx]; | |
// Create CellsColor | |
CellsColor clr = book.CreateCellsColor(); | |
clr.Color = Color.Orange; | |
group.SeriesColor = clr; | |
// Save the excel file | |
book.Save(dataDir + "Book1.out.xlsx"); |
إعداد تنسيق ثلاثي الأبعاد
قد تحتاج إلى أنماط مخططات ثلاثية الأبعاد حتى تتمكن من الحصول على نتائج السيناريو الخاص بك فقط. يوفر Aspose.Cells API ذي الصلة لتطبيق تنسيق Microsoft Excel 2007 3D.
يوجد مثال كامل أدناه لتوضيح كيفية إنشاء مخطط وتطبيق تنسيق Microsoft Excel 2007 3D. بعد تنفيذ رمز المثال ، ستتم إضافة مخطط عمودي (بتأثيرات ثلاثية الأبعاد) إلى ورقة العمل.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Create directory if it is not already present. | |
bool IsExists = System.IO.Directory.Exists(dataDir); | |
if (!IsExists) | |
System.IO.Directory.CreateDirectory(dataDir); | |
// Instantiate a new Workbook | |
Workbook book = new Workbook(); | |
// Add a Data Worksheet | |
Worksheet dataSheet = book.Worksheets.Add("DataSheet"); | |
// Add Chart Worksheet | |
Worksheet sheet = book.Worksheets.Add("MyChart"); | |
// Put some values into the cells in the data worksheet | |
dataSheet.Cells["B1"].PutValue(1); | |
dataSheet.Cells["B2"].PutValue(2); | |
dataSheet.Cells["B3"].PutValue(3); | |
dataSheet.Cells["A1"].PutValue("A"); | |
dataSheet.Cells["A2"].PutValue("B"); | |
dataSheet.Cells["A3"].PutValue("C"); | |
// Define the Chart Collection | |
ChartCollection charts = sheet.Charts; | |
// Add a Column chart to the Chart Worksheet | |
int chartSheetIdx = charts.Add(ChartType.Column, 5, 0, 25, 15); | |
// Get the newly added Chart | |
Aspose.Cells.Charts.Chart chart = book.Worksheets[2].Charts[0]; | |
// Set the background/foreground color for PlotArea/ChartArea | |
chart.PlotArea.Area.BackgroundColor = Color.White; | |
chart.ChartArea.Area.BackgroundColor = Color.White; | |
chart.PlotArea.Area.ForegroundColor = Color.White; | |
chart.ChartArea.Area.ForegroundColor = Color.White; | |
// Hide the Legend | |
chart.ShowLegend = false; | |
// Add Data Series for the Chart | |
chart.NSeries.Add("DataSheet!B1:B3", true); | |
// Specify the Category Data | |
chart.NSeries.CategoryData = "DataSheet!A1:A3"; | |
// Get the Data Series | |
Aspose.Cells.Charts.Series ser = chart.NSeries[0]; | |
// Apply the 3-D formatting | |
ShapePropertyCollection spPr = ser.ShapeProperties; | |
Format3D fmt3d = spPr.Format3D; | |
// Specify Bevel with its height/width | |
Bevel bevel = fmt3d.TopBevel; | |
bevel.Type = BevelPresetType.Circle; | |
bevel.Height = 2; | |
bevel.Width = 5; | |
// Specify Surface material type | |
fmt3d.SurfaceMaterialType = PresetMaterialType.WarmMatte; | |
// Specify surface lighting type | |
fmt3d.SurfaceLightingType = LightRigType.ThreePoint; | |
// Specify lighting angle | |
fmt3d.LightingAngle = 20; | |
// Specify Series background/foreground and line color | |
ser.Area.BackgroundColor = Color.Maroon; | |
ser.Area.ForegroundColor = Color.Maroon; | |
ser.Border.Color = Color.Maroon; | |
// Save the Excel file | |
book.Save(dataDir + "3d_format.out.xlsx"); |