简体   繁体   English

电子表格光饼图

[英]Spreadsheetlight Pie-chart

How do i display percentage on my pie chart using spreadsheetlight? 如何使用电子表格光在饼图上显示百分比?

This is my current code 这是我当前的代码

        double fChartHeight = 15.0;
        double fChartWidth = 7.5;

        SLChart chart;

        chart = sl.CreateChart("N1", "R2");
        chart.SetChartType(SLPieChartType.Pie);
        chart.SetChartPosition(piechartRow, 0, piechartRow + fChartHeight, fChartWidth);
        chart.Title.Shadow.SetPreset(SpreadsheetLight.Drawing.SLShadowPresetValues.PerspectiveDiagonalUpperLeft);              
        sl.InsertChart(chart);

        sl.SaveAs(path);

Not sure exactly what you're looking for, but hope this gets you in the right direction. 不确定您要寻找的是什么,但是希望这能为您提供正确的方向。

    double fChartHeight = 15.0;
    double fChartWidth = 7.5;

    SLChart chart;

    chart = sl.CreateChart("N1", "R2");
    chart.SetChartType(SLPieChartType.Pie);
    chart.SetChartPosition(piechartRow, 0, piechartRow + fChartHeight, fChartWidth);
    chart.Title.Shadow.SetPreset(SpreadsheetLight.Drawing.SLShadowPresetValues.PerspectiveDiagonalUpperLeft);

    SLGroupDataLabelOptions grplabels = chart.CreateGroupDataLabelOptions();
    grplabels.ShowPercentage = true;
    grplabels.ShowValue = false;
    chart.SetGroupDataLabelOptions(grplabels);

    sl.InsertChart(chart);

    sl.SaveAs(path);

If you want to tweak individual data labels, then use the SLDataLabelOptions class. 如果要调整单个数据标签,请使用SLDataLabelOptions类。 Basically, imagine how you'd do it in Excel. 基本上,想象一下如何在Excel中进行操作。 In fact, do make a pie chart in Excel. 实际上,请在Excel中制作饼图。 Format the pie chart to what you want it to look. 将饼图的格式设置为所需的外观。 Replicate the steps you did in Excel with SpreadsheetLight. 使用SpreadsheetLight复制您在Excel中执行的步骤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM