Examples of TextTitle


Examples of org.jfree.chart.title.TextTitle

   
    RectangleEdge titleEdge = getEdge(chartSettings.getTitlePosition(), RectangleEdge.TOP);
   
    if (titleText != null)
    {
      TextTitle title = jfreechart.getTitle();
      title.setText(titleText);
      if(chartSettings.getTitleColor() != null)
      {
        title.setPaint(chartSettings.getTitleColor());
      }
     
      title.setFont(titleFont);
      title.setPosition(titleEdge);
      jfreechart.setTitle(title);
    }

        String subtitleText = spiderchartBean.getSubtitleText();
    if (subtitleText != null)
    {
      TextTitle subtitle = new TextTitle(subtitleText);
      subtitle.setText(subtitleText);
      if(chartSettings.getSubtitleColor() != null)
      {
        subtitle.setPaint(chartSettings.getSubtitleColor());
      }

      if(chartSettings.getSubtitleColor() != null)
      {
            Font subtitleFont = chartSettings.getSubtitleFont() != null
            ? JRFontUtil.getAwtFont(chartSettings.getSubtitleFont(), Locale.getDefault())
            : TextTitle.DEFAULT_FONT;
        subtitle.setFont(subtitleFont);
      }
     
      subtitle.setPosition(titleEdge);

      jfreechart.addSubtitle(subtitle);
    }

    // Apply all of the legend formatting options
View Full Code Here

Examples of org.jfree.chart.title.TextTitle

   
    RectangleEdge titleEdge = getEdge(getChart().getTitlePositionValue(), RectangleEdge.TOP);
   
    if (jfreeChart.getTitle() != null)
    {
      TextTitle title = jfreeChart.getTitle();
      title.setPaint(getChart().getTitleColor());

      title.setFont(JRFontUtil.getAwtFont(getChart().getTitleFont(), getLocale()));
      title.setPosition(titleEdge);
    }

    String subtitleText = (String)evaluateExpression(getChart().getSubtitleExpression());
    if (subtitleText != null)
    {
      TextTitle subtitle = new TextTitle(subtitleText);
      subtitle.setPaint(getChart().getSubtitleColor());

      subtitle.setFont(JRFontUtil.getAwtFont(getChart().getSubtitleFont(), getLocale()));
      subtitle.setPosition(titleEdge);

      jfreeChart.addSubtitle(subtitle);
    }

    // Apply all of the legend formatting options
View Full Code Here

Examples of org.jfree.chart.title.TextTitle

  {
    TitleSettings titleSettings =  getTitleSettings();
    Boolean showTitle = titleSettings.getShowTitle();
    if(showTitle == null || showTitle.booleanValue())
    {
      TextTitle title = jfreeChart.getTitle();
         
      if(title != null)
      {
        Paint forePaint = getChart().getOwnTitleColor();
        if (forePaint == null && titleSettings.getForegroundPaint() != null)
View Full Code Here

Examples of org.jfree.chart.title.TextTitle

    if(subtitleVisibility == null || subtitleVisibility.booleanValue())
    {
      String subtitleText = (String)evaluateExpression(getChart().getSubtitleExpression());
      if (subtitleText != null)
      {
        TextTitle subtitle = new TextTitle(subtitleText);
        Paint subtitleForecolor = getChart().getOwnSubtitleColor() != null 
          ? getChart().getOwnSubtitleColor()
          : subtitleSettings.getForegroundPaint() != null 
          ? subtitleSettings.getForegroundPaint().getPaint()
          : getChart().getSubtitleColor();
View Full Code Here

Examples of org.jfree.chart.title.TextTitle

   */
  protected void configureChart(JFreeChart jfreeChart, JRChartPlot jrPlot) throws JRException
  {

    super.configureChart(jfreeChart, jrPlot);
    TextTitle title = jfreeChart.getTitle();

    if(title != null)
    {
     
      RectangleInsets padding = title.getPadding();
      double bottomPadding = Math.max(padding.getBottom(), 15d);
      title.setPadding(padding.getTop(), padding.getLeft(), bottomPadding, padding.getRight());
    }
  }
View Full Code Here

Examples of org.jfree.chart.title.TextTitle

  protected void setChartTitle(JFreeChart jfreeChart, Integer baseFontSize)
  {
    Boolean titleVisibility = (Boolean)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.TITLE_VISIBLE);
    if(titleVisibility != null && titleVisibility.booleanValue())
    {
      TextTitle title = jfreeChart.getTitle();
     
      RectangleEdge titleEdge = null;
         
      if(title != null)
      {
        JRFont titleFont = getChart().getTitleFont();

        Font themeTitleFont = getFont((JRFont)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.TITLE_FONT), titleFont, baseFontSize);
        title.setFont(themeTitleFont);
       
        HorizontalAlignment defaultTitleHAlignment = (HorizontalAlignment)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.TITLE_HORIZONTAL_ALIGNMENT);
        if(defaultTitleHAlignment != null)
          title.setHorizontalAlignment(defaultTitleHAlignment);
       
        VerticalAlignment defaultTitleVAlignment = (VerticalAlignment)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.TITLE_VERTICAL_ALIGNMENT);
        if(defaultTitleVAlignment != null)
          title.setVerticalAlignment(defaultTitleVAlignment);
       
        RectangleInsets defaultTitlePadding = (RectangleInsets)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.TITLE_PADDING);
        RectangleInsets titlePadding = title.getPadding() != null ? title.getPadding() : defaultTitlePadding;
        if(titlePadding != null)
          title.setPadding(titlePadding);
       
        Color titleForecolor = getChart().getOwnTitleColor() != null ?
            getChart().getOwnTitleColor() :
            (getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.TITLE_FORECOLOR) != null ?
                (Color)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.TITLE_FORECOLOR) :
                getChart().getTitleColor());
        if(titleForecolor != null)
          title.setPaint(titleForecolor);
 
        Color titleBackcolor = (Color)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.TITLE_BACKCOLOR);
        if(titleBackcolor != null)
          title.setBackgroundPaint(titleBackcolor);
       
        RectangleEdge defaultTitlePosition = (RectangleEdge)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.TITLE_POSITION);
        titleEdge = getEdge(getChart().getTitlePositionValue(), defaultTitlePosition);
        if(titleEdge != null)
          title.setPosition(titleEdge);
      }
    }
    else
    {
      TextTitle title = null;
      jfreeChart.setTitle(title);
    }
  }
View Full Code Here

Examples of org.jfree.chart.title.TextTitle

    if(subtitleVisibility != null && subtitleVisibility.booleanValue())
    {
      String subtitleText = (String)evaluateExpression(getChart().getSubtitleExpression());
      if (subtitleText != null)
      {
        TextTitle subtitle = new TextTitle(subtitleText);
       
        Font themeSubtitleFont = getFont((JRFont)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_FONT), getChart().getSubtitleFont(), baseFontSize);
        subtitle.setFont(themeSubtitleFont);
       
        HorizontalAlignment defaultSubtitleHAlignment = (HorizontalAlignment)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_HORIZONTAL_ALIGNMENT);
        if(defaultSubtitleHAlignment != null)
          subtitle.setHorizontalAlignment(defaultSubtitleHAlignment);

        VerticalAlignment defaultSubtitleVAlignment = (VerticalAlignment)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_VERTICAL_ALIGNMENT);
        if(defaultSubtitleVAlignment != null)
          subtitle.setVerticalAlignment(defaultSubtitleVAlignment);
       
        RectangleInsets defaultSubtitlePadding = (RectangleInsets)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_PADDING);
        RectangleInsets subtitlePadding = subtitle.getPadding() != null ? subtitle.getPadding() : defaultSubtitlePadding;
        if(subtitlePadding != null)
          subtitle.setPadding(subtitlePadding);

        Color subtitleForecolor = getChart().getOwnSubtitleColor() != null ?
            getChart().getOwnSubtitleColor() :
            (getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_FORECOLOR) != null ?
                (Color)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_FORECOLOR) :
                getChart().getSubtitleColor());
        if(subtitleForecolor != null)
          subtitle.setPaint(subtitleForecolor);
 
        Color subtitleBackcolor = getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_BACKCOLOR) != null ?
            (Color)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_BACKCOLOR) :
            null;
        if(subtitleBackcolor != null)
          subtitle.setBackgroundPaint(subtitleBackcolor);
 
        RectangleEdge defaultSubtitlePosition = (RectangleEdge)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_POSITION);
        //Subtitle has not its own position set, and by default this will be set the same as title position
        RectangleEdge subtitleEdge = null;
        if(defaultSubtitlePosition == null)
        { 
          subtitleEdge = jfreeChart.getTitle().getPosition();
        }
        else
        {
          subtitleEdge = defaultSubtitlePosition;
        }
        if(subtitleEdge != null)
          subtitle.setPosition(subtitleEdge);
       
        jfreeChart.addSubtitle(subtitle);
      }
    }
  }
View Full Code Here

Examples of org.jfree.chart.title.TextTitle

   */
  protected void configureChart(JFreeChart jfreeChart, JRChartPlot jrPlot) throws JRException
  {
    super.configureChart(jfreeChart, jrPlot);

    TextTitle title = jfreeChart.getTitle();
    if(title != null)
    {
      RectangleInsets padding = title.getPadding();
      double bottomPadding = Math.max(padding.getBottom(), 15d);
      title.setPadding(padding.getTop(), padding.getLeft(), bottomPadding, padding.getRight());
    }

    GradientPaint gp = (GradientPaint)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.BACKGROUND_PAINT);

    jfreeChart.setBackgroundPaint(new GradientPaint(0f, 0f, gp.getColor1(), 0f, getChart().getHeight() * 0.7f, gp.getColor2(), false));
View Full Code Here

Examples of org.jfree.chart.title.TextTitle

        // set the background color for the chart...
        chart.setBackgroundPaint(Color.white);
        chart.getTitle().setMargin(2.0, 0.0, 0.0, 0.0);

        TextTitle tt = new TextTitle(
                "Source: http://news.bbc.co.uk/1/hi/world/6063386.stm",
                new Font("Dialog", Font.PLAIN, 11));
        tt.setPosition(RectangleEdge.BOTTOM);
        tt.setHorizontalAlignment(HorizontalAlignment.RIGHT);
        tt.setMargin(0.0, 0.0, 4.0, 4.0);
        chart.addSubtitle(tt);

        TextTitle t = new TextTitle(
                "(*) Across 27,000 respondents in 25 countries",
                new Font("Dialog", Font.PLAIN, 11));
        t.setPosition(RectangleEdge.BOTTOM);
        t.setHorizontalAlignment(HorizontalAlignment.RIGHT);
        t.setMargin(4.0, 0.0, 2.0, 4.0);
        chart.addSubtitle(t);

        // get a reference to the plot for further customisation...
        CategoryPlot plot = (CategoryPlot) chart.getPlot();
        LegendItemCollection items = new LegendItemCollection();
View Full Code Here

Examples of org.jfree.chart.title.TextTitle

    private ChartPanel chartPanel;

    public ContextPieChart() {
        data = new DefaultPieDataset();
        final JFreeChart chart = ChartFactory.createPieChart("Employee Survey", data, false, false, false);
        chart.setTitle(new TextTitle());
        chart.setBackgroundPaint(null);
        chart.setPadding(new RectangleInsets(0, 0, 0, 0));
        PiePlot plot = (PiePlot) chart.getPlot();
        plot.setShadowPaint(null);
        plot.setSimpleLabels(true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.