首页 新闻 会员 周边

画饼形图的代码看不懂 大哥们解释下

0
悬赏园豆:5

dataSum += tmpSeries->GetData(s);
     percent = (dataSum * 100) / totalSum;
     degrees = (360 * percent) / 100;

     deltaXY = (degrees * radius) / 90;
          int quadrant = degrees / 90;  

     switch(quadrant)
     {
             case 0 : newXLocation = pieLeft + deltaXY;
         newYLocation = centerYPie + deltaXY;
         break;
      case 1 : newXLocation = pieLeft + deltaXY;
         newYLocation = centerYPie + (2 * radius) - deltaXY;
//         newYLocation = centerYPie + radius - (deltaXY - radius);
         break;
      case 2 : newXLocation = pieLeft + (4 * radius) - deltaXY;
//         newXLocation = pieLeft + (2 * radius) - (deltaXY - (2 * radius));
         newYLocation = centerYPie + (2 * radius) - deltaXY;
//         newYLocation = centerYPie - (deltaXY - (2 * radius));
         break;
      case 3 : newXLocation = pieLeft + (4 * radius) - deltaXY;
//         newXLocation = pieLeft + radius - (deltaXY - (3 * radius));
         newYLocation = centerYPie - (4 * radius) + deltaXY;
//         newYLocation = centerYPie - radius + (deltaXY - (3 * radius));
         break;
      case 4 : newXLocation = pieLeft;
         newYLocation = centerYPie - 1;
         break;
     }

阿乐的主页 阿乐 | 初学一级 | 园豆:105
提问于:2009-10-24 20:01
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册