找回密码
 立即注册

QQ登录

只需一步,快速开始

keith

金牌服务用户

3

主题

14

帖子

113

积分

金牌服务用户

积分
113

活字格认证微信认证勋章

最新发帖
keith
金牌服务用户   /  发表于:2016-4-25 15:56  /   查看:4576  /  回复:5
本帖最后由 Lenka.Guo 于 2016-4-25 17:27 编辑

在制作Spread  Win  Chart时,数据源见附件Test.xslx,在按钮上调用this.fpSpread1_Sheet1.AddChart方法可以正常显示图标(见截图1),最终效果想实现为见截图2



调用方法效果

调用方法效果

最终所需效果

最终所需效果

test.xlsx

10.54 KB, 下载次数: 147

数据源

5 个回复

倒序浏览
Lenka.Guo讲师达人认证 悬赏达人认证
超级版主   /  发表于:2016-4-25 17:26:44
沙发
本帖最后由 Lenka.Guo 于 2016-4-26 14:38 编辑

您好,问题已经收到,实现效果图;

主要设置pieSeries 的三个属性,LabelVisible ,LabelContainsCategoryName,CategoryNames

FarPoint.Win.Chart.PieSeries pieSeries5 = new FarPoint.Win.Chart.PieSeries();
pieSeries5.LabelVisible = true;
pieSeries5.LabelContainsCategoryName = true;
pieSeries5.CategoryNames.AddRange(new string[] {
            "未完成",
            "已完成",
            ""});

this.fpSpread1_Sheet1_SpreadChart2 = new FarPoint.Win.Spread.Chart.SpreadChart(pieSeries5, "SpreadChart2");
回复 使用道具 举报
keith
金牌服务用户   /  发表于:2016-4-25 20:24:36
板凳
Lenka.Guo 发表于 2016-4-25 17:26
您好,问题已经收到,实现效果图;

主要设置pieSeries 的三个属性,LabelVisible ,LabelContainsCatego ...

你好!

   this.fpSpread1_Sheet1_SpreadChart2 = new FarPoint.Win.Spread.Chart.SpreadChart(pieSeries5, "SpreadChart2");  这句没看明白,运行错误。

按钮调用代码:
   private void button2_Click(object sender, EventArgs e)
        {
            CellRange cr1 = new CellRange(1, 1, 1, 2);
            CellRange cr2 = new CellRange(2, 1, 1, 2);
            CellRange cr3 = new CellRange(3, 1, 1, 2);
            CellRange cr4 = new CellRange(4, 1, 1, 2);


            //this.fpSpread1_Sheet1.AddChart(cr1, typeof(FarPoint.Win.Chart.PieSeries), 300, 300, 0, 100);
            //this.fpSpread1_Sheet1.AddChart(cr, typeof(FarPoint.Win.Chart.PieSeries), 400, 300, 0, 300, FarPoint.Win.Chart.ChartViewType.View3D, true);
            this.fpSpread1_Sheet1.AddChart(cr1, typeof(FarPoint.Win.Chart.PieSeries), 300, 300, 0, 100, FarPoint.Win.Chart.ChartViewType.View3D, true);
            this.fpSpread1_Sheet1.AddChart(cr2, typeof(FarPoint.Win.Chart.PieSeries), 300, 300, 310, 100, FarPoint.Win.Chart.ChartViewType.View3D, true);
            this.fpSpread1_Sheet1.AddChart(cr3, typeof(FarPoint.Win.Chart.PieSeries), 300, 300, 620, 100, FarPoint.Win.Chart.ChartViewType.View3D, true);
            this.fpSpread1_Sheet1.AddChart(cr4, typeof(FarPoint.Win.Chart.PieSeries), 300, 300, 930, 100, FarPoint.Win.Chart.ChartViewType.View3D, true);

            //FarPoint.Win.Chart.PieSeries pieSeries5 = new FarPoint.Win.Chart.PieSeries();
            //pieSeries5.LabelVisible = true;
            //pieSeries5.LabelContainsCategoryName = true;
            //pieSeries5.CategoryNames.AddRange(new string[] {
            //"未完成",
            //"已完成",
            //""});
            //this.fpSpread1_Sheet1_SpreadChart = new FarPoint.Win.Spread.Chart.SpreadChart(pieSeries5, "SpreadChart2");

        }
这样就生成了图1的效果。
回复 使用道具 举报
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2016-4-26 11:06:14
地板
  1.             var pieSeries1 = this.fpSpread1_Sheet1.Charts[0].GetSeries(0) as FarPoint.Win.Chart.PieSeries;
  2.             pieSeries1.LabelVisible = true;
  3.             pieSeries1.LabelContainsCategoryName = true;
  4.             pieSeries1.CategoryNames.AddRange(new string[] {
  5.             "未完成",
  6.             "已完成",
  7.             ""});
复制代码
回复 使用道具 举报
keith
金牌服务用户   /  发表于:2016-4-27 09:44:07
5#

你好:

按照上述代码示例,可以正常显示饼状的信息,但图形标题无法显示。
回复 使用道具 举报
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2016-4-27 10:14:58
6#
您把前面一列加上自动就出来了

  1.             CellRange cr1 = new CellRange(1, 0, 1, 3);
  2.             CellRange cr2 = new CellRange(2, 0, 1, 3);
  3.             CellRange cr3 = new CellRange(3, 0, 1, 3);
  4.             CellRange cr4 = new CellRange(4, 0, 1, 3);
复制代码

回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部