예제 #1
0
        public void draw(Graphics g) {
            if (g == null) {
                throw new ArgumentNullException("g");
            }
            if (m_datasource == null) {
                return;
            }
			
            init();
            drawBackground(g);
            drawTitle(g);

            if (m_datasource.SeriesCollection.Count == 0) {
                return;
            }
            Insets insets = new Insets(m_insets.Top, m_insets.Left, m_insets.Bottom, m_insets.Right);
            calculateInsets(insets, g);
            Rectangle bound = new Rectangle(insets.Left, 
                                            insets.Top, 
                                            m_size.Width - insets.Left - insets.Right, 
                                            m_size.Height - insets.Top - insets.Bottom);
			
            drawChart(g, bound);
			
//            if (m_enableLegend) {
//                drawLegend(g);
//            }
        }
예제 #2
0
 public AbstractChart(Size size) {
     m_size = size;
     m_backgroundColor = Color.White;
     m_insets = new Insets(10, 10, 10, 10);
     m_enableLegend = true;
     Enable3D = true;
 }
예제 #3
0
 protected override void calculateInsets(Insets insets, Graphics g)
 {
     base.calculateInsets(insets, g);
     if (m_labels == null || m_labels.Length == 0) {
         return;
     }
     int maxWidth = 0;
     int maxHeight = 0;
     foreach (Label label in m_labels) {
         int labelWidth = label.getWidth(g);
         int labelHeight = label.getHeight(g);
         maxWidth = maxWidth < labelWidth ? labelWidth : maxWidth;
         maxHeight = maxHeight < labelHeight ? labelHeight : maxHeight;
     }
     insets.Left += (maxWidth + m_space);
     insets.Right += (maxWidth + m_space);
     insets.Top += (maxHeight + m_space);
     insets.Bottom += (maxHeight + m_space);
 }
예제 #4
0
 protected virtual void calculateInsets(Insets insets, Graphics g)
 {
     // TODO: Need to get an accurate legend height.
     int legendHeight = 25;
     if (m_titleLabel != null) {
         insets.Top += (int) m_titleLabel.getHeight(g);
     }
     if (m_enableLegend) {
         insets.Bottom += legendHeight;
     }
 }