Example #1
0
        internal Grapher(RrdGraphDef graphDef, RrdGraph rrdGraph)
        {
            this.graphDef = graphDef;
            this.rrdGraph = rrdGraph;

            // Set font dimension specifics
            if (graphDef.DefaultFont != null)
            {
                normal_font = graphDef.DefaultFont;
            }
            if (graphDef.TitleFont != null)
            {
                title_font = graphDef.TitleFont;
            }
            normalFontColor = graphDef.DefaultFontColor;

            nfont_height = (int)normal_font.GetHeight();
            // MONO FIX: Font.GetHeight() always returns 0 on mono 1.0
            if (nfont_height == 0)
            {
                nfont_height = (int)normal_font.Size;
            }
            nfont_width = nfont_height / 2 + 1;

            sf             = StringFormat.GenericDefault;
            sf.FormatFlags = StringFormatFlags.MeasureTrailingSpaces;

            // Bold font is higher
            tfont_height = (int)title_font.GetHeight();
            // MONO FIX: Font.GetHeight() always returns 0 on mono 1.0
            if (tfont_height == 0)
            {
                tfont_height = (int)title_font.Size;
            }
            tfont_width = tfont_height / 2 + 1;

            // Create the shared valueformatter
            valueFormat = new ValueFormatter(graphDef.BaseValue, graphDef.ScaleIndex);

            // Set default graph stroke
            defaultPen   = new Pen(Color.Black);
            dashPen      = new Pen(Color.Black, 1);
            defaultBrush = new SolidBrush(Color.White);
        }
Example #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="graphDef"></param>
 public void SetGraphDef(RrdGraphDef graphDef)
 {
     img     = null;
     grapher = new Grapher(graphDef, this);
 }
Example #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="graphDef"></param>
 public RrdGraph(RrdGraphDef graphDef)
 {
     grapher = new Grapher(graphDef, this);
 }