Package org.pentaho.platform.uifoundation.chart

Examples of org.pentaho.platform.uifoundation.chart.CategoryDatasetChartComponent


    SimpleUrlFactory urlFactory = new SimpleUrlFactory( "/testurl?" ); //$NON-NLS-1$
    ArrayList messages = new ArrayList();

    int chartWidth = 400;
    int chartHeight = 400;
    CategoryDatasetChartComponent categoryChartComponent =
        new CategoryDatasetChartComponent( chartType, path, chartWidth, chartHeight, urlFactory, messages );

    categoryChartComponent.setLoggingLevel( ILogger.ERROR );
    categoryChartComponent.setByRow( true );

    categoryChartComponent.setDataAction( "/test-src/solution/test/rules/department_stats.xaction", "rule-result" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$

    OutputStream outputStream = getOutputStream( "ChartTest." + testName, ".html" ); //$NON-NLS-1$//$NON-NLS-2$
    String contentType = "text/html"; //$NON-NLS-1$

    SimpleParameterProvider requestParameters = new SimpleParameterProvider();
    SimpleParameterProvider sessionParameters = new SimpleParameterProvider();

    HashMap parameterProviders = new HashMap();
    parameterProviders.put( IParameterProvider.SCOPE_REQUEST, requestParameters );
    parameterProviders.put( IParameterProvider.SCOPE_SESSION, sessionParameters );
    StandaloneSession session =
        new StandaloneSession( Messages.getInstance().getString( "BaseTest.DEBUG_JUNIT_SESSION" ) ); //$NON-NLS-1$
    UserSession usession = new UserSession( "Admin", Locale.US, true, requestParameters ); //$NON-NLS-1$
    usession.doStartupActions( requestParameters );
    UserSession usessionNoAuth = new UserSession( "Admin", Locale.US, requestParameters ); //$NON-NLS-1$
    usessionNoAuth.doStartupActions( requestParameters );
    SimpleOutputHandler outputHandler = new SimpleOutputHandler( outputStream, false );
    BaseRequestHandler requestHandler = new BaseRequestHandler( session, null, outputHandler, null, urlFactory );

    try {
      categoryChartComponent.validate( session, requestHandler );
      categoryChartComponent.handleRequest( outputStream, requestHandler, contentType, parameterProviders );
    } catch ( IOException e ) {
      e.printStackTrace();
    }

  }
View Full Code Here


    int chartType = (int) requestParameters.getLongParameter( "ChartType", JFreeChartEngine.UNDEFINED_CHART_TYPE ); //$NON-NLS-1$
    String chartDefinitionPath = requestParameters.getStringParameter( "ChartDefinitionPath", null ); //$NON-NLS-1$

    ArrayList messages = new ArrayList();
    CategoryDatasetChartComponent barChart =
        new CategoryDatasetChartComponent( chartType, chartDefinitionPath, 600, 400, urlFactory, messages );

    String content = null;
    IPentahoConnection connection =
        PentahoConnectionFactory.getConnection( IPentahoConnection.SQL_DATASOURCE, "SampleData", userSession, this ); //$NON-NLS-1$
    try {
      String query = "select department, actual, budget, variance from QUADRANT_ACTUALS"; //$NON-NLS-1$

      IPentahoResultSet results = connection.executeQuery( query );
      try {

        barChart.setValues( results );
        barChart.validate( userSession, null );

        barChart.setParameterProvider( IParameterProvider.SCOPE_REQUEST, requestParameters );
        barChart.setParameterProvider( IParameterProvider.SCOPE_SESSION, sessionParameters );

        content = barChart.getContent( "text/html" ); //$NON-NLS-1$
      } finally {
        results.close();
      }
    } finally {
      connection.close();
View Full Code Here

TOP

Related Classes of org.pentaho.platform.uifoundation.chart.CategoryDatasetChartComponent

Copyright © 2018 www.massapicom. 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.