当前位置: 首页>>代码示例>>Java>>正文


Java RainbowScale类代码示例

本文整理汇总了Java中com.orsoncharts.renderer.RainbowScale的典型用法代码示例。如果您正苦于以下问题:Java RainbowScale类的具体用法?Java RainbowScale怎么用?Java RainbowScale使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RainbowScale类属于com.orsoncharts.renderer包,在下文中一共展示了RainbowScale类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createChart

import com.orsoncharts.renderer.RainbowScale; //导入依赖的package包/类
/**
 * Creates a surface chart for the demo.
 * 
 * @return A surface chart.
 */
private static Chart3D createChart() {
    Function3D function = new Function3D() {
        @Override
        public double getValue(double x, double z) {
            return Math.sin(x * x + z * z);
        }
    };
    
    Chart3D chart = Chart3DFactory.createSurfaceChart(
            "SurfaceRendererDemo2", 
            "y = sin(x^2 + z^2)", 
            function, "X", "Y", "Z");
    XYZPlot plot = (XYZPlot) chart.getPlot();
    plot.setDimensions(new Dimension3D(10, 5, 10));
    ValueAxis3D xAxis = plot.getXAxis();
    xAxis.setRange(-2, 2);
    ValueAxis3D zAxis = plot.getZAxis();
    zAxis.setRange(-2, 2);
    SurfaceRenderer renderer = (SurfaceRenderer) plot.getRenderer();
    renderer.setColorScale(new RainbowScale(new Range(-1.0, 1.0)));
    renderer.setDrawFaceOutlines(false);
    chart.setLegendPosition(LegendAnchor.BOTTOM_RIGHT, 
            Orientation.VERTICAL);
    return chart;
}
 
开发者ID:jfree,项目名称:jfree-fxdemos,代码行数:31,代码来源:SurfaceRendererFXDemo2.java

示例2: createAndShow

import com.orsoncharts.renderer.RainbowScale; //导入依赖的package包/类
@Override
public void createAndShow() throws Exception {
           gr3DPlt frameToShow;
    
    
    //toShow = toShow.replace(" ","");
    if(!toShow.startsWith("gr3DPlt")||toShow.length()<8)
         return;
     String txt = jc.getInside(toShow.substring(8),'(',')'); 
      String bf;
      
      String ExceptionMessage="gr3DPlt is not defined correctly!";
  if(txt.indexOf('{')==-1||txt.indexOf('=')==-1)
      throw new Exception(ExceptionMessage);
 int splitIndex = txt.substring(0,txt.indexOf('{')).lastIndexOf(',');
     if(splitIndex == -1)
         throw new Exception(ExceptionMessage); 
     bf = txt.substring(splitIndex+1);
    function=txt.substring(0,splitIndex);
    title=function;
    frameToShow=new gr3DPlt(title);
   if(function.indexOf('=')!=-1)
       function=function.substring(function.indexOf('=')+1);
  String[] raw = bf.split("\\.\\.");
    for(String chunk:raw){
        if(chunk.indexOf('=')!=-1){
            if(chunk.indexOf('}')!=-1)
              Vars.add(chunk.substring(chunk.indexOf(',')+1,chunk.indexOf('=')).trim());
            else
                Vars.add(chunk.substring(0,chunk.indexOf('=')).trim());
            if(chunk.indexOf('{')==-1)
                throw new Exception(ExceptionMessage);
            rangeLeft.add(jc.eval(chunk.substring(chunk.lastIndexOf('{')+1)));
            if(chunk.indexOf('}')!=-1)
                rangeRight.add(jc.eval(chunk.substring(0,chunk.indexOf('}'))));
        }
        else{
            if(chunk.indexOf('}')==-1)
                throw new Exception(ExceptionMessage);
            
            rangeRight.add(jc.eval(chunk.substring(0,chunk.indexOf('}'))));
        }
    }
    if(Vars.size()!=rangeLeft.size()||Vars.size()!=rangeRight.size())
        throw new Exception(ExceptionMessage);  
    if(Vars.size()<2)
        throw new Exception(ExceptionMessage);
         
          chart = Chart3DFactory.createSurfaceChart(
            "", 
            function, 
            this, Vars.get(0),"Z",Vars.get(1));
    XYZPlot plot = (XYZPlot) chart.getPlot();
   // plot.setDimensions(new Dimension3D(10, 5, 10));
    ValueAxis3D xAxis = plot.getXAxis();
    //System.out.println(rangeLeft.get(0));
    xAxis.setRange(new Double(rangeLeft.get(0)), new Double(rangeRight.get(0)));
    ValueAxis3D zAxis = plot.getZAxis();
    zAxis.setRange(new Double(rangeLeft.get(1)), new Double(rangeRight.get(1)));
    SurfaceRenderer renderer = (SurfaceRenderer) plot.getRenderer();
    renderer.setColorScale(new RainbowScale(new Range(-1.0, 1.0)));
    renderer.setDrawFaceOutlines(false);
    chart.setLegendPosition(LegendAnchor.BOTTOM_RIGHT, 
            Orientation.VERTICAL);
           
    DemoPanel content = new DemoPanel(new BorderLayout());
    content.setPreferredSize(DEFAULT_CONTENT_SIZE);
    //Chart3D chart = SurfaceRenderer2.createChart();
    Chart3DPanel chartPanel = new Chart3DPanel(chart);
    chartPanel.zoomToFit(DEFAULT_CONTENT_SIZE);
    content.setChartPanel(chartPanel);
    content.add(new DisplayPanel3D(chartPanel));
    frameToShow.getContentPane().add(content);
    //frameToShow.setJMenuBar(gr3DPlt.getMenu(frameToShow.getChart(),frameToShow));
    frameToShow.pack();
    RefineryUtilities.centerFrameOnScreen(frameToShow);
   frameToShow.setVisible(true);
   // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
 
开发者ID:mathhobbit,项目名称:EditCalculateAndChart,代码行数:80,代码来源:gr3DPlt.java


注:本文中的com.orsoncharts.renderer.RainbowScale类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。