Creates the JRDesignChart from the DJChart. To do so it also creates needed variables and data-set

@param djChart
@return
506382
protected JRDesignChart createChart(ar.com.fdvs.dj.domain.chart.DJChart djChart, String name) {
        JRDesignGroup jrGroupChart = getChartColumnsGroup(djChart);
        JRDesignGroup parentGroup = getParent(jrGroupChart);
        Map chartVariables = registerChartVariable(djChart);
        return djChart.transform((DynamicJasperDesign) getDesign(), name, jrGroupChart, parentGroup, chartVariables, getReport().getOptions().getPrintableWidth());
    }
1343056
public static String createJquery(Chart<?> chart, String divId) {
        return createJquery(chart, divId, null);
    }
31357
private Chart getChartFromParams(final PageParameters params) {
        String chartString;
        String themeString;
        Chart config;

        //If the showcase is started without any parameters
        //set the parameters to lineBasic and give us a line Chart
        if(params.getAllNamed().size() < 2){
            PageParameters temp = new PageParameters();
            temp.add("theme", "default");
            temp.add("chart", "line");
            setResponsePage(HomepageHighcharts.class, temp);
            config = new Chart("chart", new BasicLineOptions(), null);
            return config;
        }

        themeString = params.getAllNamed().get(0).getValue();
        Theme theme = getThemeFromParams(themeString);
        chartString = params.getAllNamed().get(1).getValue();

        if(chartString == null) {
            config = new Chart("chart", new BasicLineOptions(), theme);
            return config;
        }

        switch(chartString) {
            case "basicBar":
                config = new Chart("chart", new BasicBarOptions(), theme);
                break;

            case "splineWithSymbols":
                config = new Chart("chart", new SplineWithSymbolsOptions(), theme);
                break;

            case "irregularIntervals":
                config = new Chart("chart", new TimeDataWithIrregularIntervalsOptions(), theme);
                break;

            case "logarithmicAxis":
                config = new Chart("chart", new LogarithmicAxisOptions(), theme);
                break;

            case "scatter":
                config = new Chart("chart", new ScatterPlotOptions(), theme);
                break;

            case "area":
                config = new Chart("chart", new BasicAreaOptions(), theme);
                break;

            case "areaWithNegativeValues":
                config = new Chart("chart", new AreaWithNegativeValuesOptions(), theme);
                break;

            case "stackedAndGroupedColumn":
                config = new Chart("chart", new StackedAndGroupedColumnOptions(), theme);
                break;

            case "combo":
                config = new Chart("chart", new ComboOptions(), theme);
                break;

            case "donut":
                config = new Chart("chart", new DonutOptions(), theme);
                break;

            case "withDataLabels":
                config = new Chart("chart", new LineWithDataLabelsOptions(), theme);
                break;

            case "zoomableTimeSeries":
                config = new Chart("chart", new ZoomableTimeSeriesOptions(), theme);
                break;

            case "splineInverted":
                config = new Chart("chart", new SplineWithInvertedAxisOptions(), theme);
                break;

            case "splineWithPlotBands":
                config = new Chart("chart", new SplineWithPlotBandsOptions(), theme);
                break;

            case "polar":
                config = new Chart("chart", new PolarOptions(), theme);
                break;

            case "stackedArea":
                config = new Chart("chart", new StackedAreaOptions(), theme);
                break;

            case "percentageArea":
                config = new Chart("chart", new PercentageAreaOptions(), theme);
                break;

            case "areaMissing":
                config = new Chart("chart", new AreaMissingOptions(), theme);
                break;

            case "areaInverted":
                config = new Chart("chart", new AreaInvertedAxisOptions(), theme);
                break;

            case "areaSpline":
                config = new Chart("chart", new AreaSplineOptions(), theme);
                break;

            case "areaSplineRange":
                config = new Chart("chart", new AreaSplineRangeOptions(), theme);
                break;

            case "columnWithDrilldown":
                config = new Chart("chart", new ColumnWithDrilldownOptions(), theme);
                break;

            case "columnRotated":
                config = new Chart("chart", new ColumnWithRotatedLabelsOptions(), theme);
                break;

            case "stackedBar":
                config = new Chart("chart", new StackedBarOptions(), theme);
                break;

            case "barNegativeStack":
                config = new Chart("chart", new StackedBarOptions(), theme);
                break;

            case "basicColumn":
                config = new Chart("chart", new BasicColumnOptions(), theme);
                break;

            case "columnWithNegativeValues":
                config = new Chart("chart", new ColumnWithNegativeValuesOptions(), theme);
                break;

            case "stackedColumn":
                config = new Chart("chart", new StackedColumnOptions(), theme);
                break;

            case "stackedPercentage":
                config = new Chart("chart", new StackedPercentageOptions(), theme);
                break;

            case "basicPie":
                config = new Chart("chart", new BasicPieOptions(), theme);
                break;

            case "pieWithGradient":
                config = new Chart("chart", new PieWithGradientOptions(), theme);
                break;

            case "pieWithLegend":
                config = new Chart("chart", new PieWithLegendOptions(), theme);
                break;

            case "splineUpdating":
                config = new Chart("chart", new WicketSplineUpdatingOptions(), theme);
                break;

            case "bubble":
                config = new Chart("chart", new BubbleChartOptions(), theme);
                break;

            case "3dbubble":
                config = new Chart("chart", new BubbleChart3DOptions(), theme);
                break;

            case "boxplot":
                config = new Chart("chart", new BoxplotChartOptions(), theme);
                break;

            case "interactive":
                config = new Chart("chart", new InteractionOptions(), theme);
                break;

            case "angularGauge":
                config = new Chart("chart", new AngularGaugeOptions(), theme);
                break;

            case "spiderweb":
                config = new Chart("chart", new SpiderwebOptions(), theme);
                break;

            case "windrose":
                config = new Chart("chart", new WindroseOptions(), theme);
                break;

            case "columnrange":
                config = new Chart("chart", new ColumnRangeOptions(), theme);
                break;

            case "arearange":
                config = new Chart("chart", new AreaRangeOptions(), theme);
                break;

            case "clicktoadd":
                config = new Chart("chart", new ClickToAddAPointOptions(), theme);
                break;

            case "dualAxes":
                config = new Chart("chart", new DualAxesOptions(), theme);
                break;

            case "scatterWithRegression":
                config = new Chart("chart", new ScatterWithRegressionLineOptions(), theme);
                break;

            case "multipleAxes":
                config = new Chart("chart", new MultipleAxesOptions(), theme);
                break;

            case "errorBar":
                config = new Chart("chart", new ErrorBarOptions(), theme);
                break;

            case "funnel":
                config = new Chart("chart", new FunnelOptions(), theme);
                break;

            case "pyramid":
                config = new Chart("chart", new PyramidOptions(), theme);
                break;

            case "heatmap":
                config = new Chart("chart", new HeatmapOptions(), theme);
                break;

            default:
                config = new Chart("chart", new BasicLineOptions(), theme);
                break;
        }
        return config;
    }
909317
public static void plotCharts(List<Chart> charts){
		int numRows =1;
		int numCols =1;
		if(charts.size()>1){
			numRows = (int) Math.ceil(charts.size()/2.0);
			numCols = 2;
		}
		
	    final JFrame frame = new JFrame("");
	    frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
        frame.getContentPane().setLayout(new GridLayout(numRows, numCols));
	    for (Chart chart : charts) {
	          if (chart != null) {
	            JPanel chartPanel = new XChartPanel(chart);
	            frame.add(chartPanel);
	          }
	          else {
	            JPanel chartPanel = new JPanel();
	            frame.getContentPane().add(chartPanel);
	          }

	        }
	    // Display the window.
        frame.pack();
        frame.setVisible(true);
	}
48076
private static void createAndShowGUI() {

    // Create and set up the window.
    JFrame frame = new JFrame("XChart Demo");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    // Add content to the window.
    frame.add(new XChartDemo());

    // Display the window.
    frame.pack();
    frame.setVisible(true);
  }
1097638
public String getJsonData(Chart chart)
            throws ReportRunnerException, NoDataFoundException, TimeoutException {
        return getJsonData(chart, null, null);
	}
484109
private DefaultPanel createTopPanel() {
		DefaultPanel top = new DefaultPanel();
		top.setLayout(new BoxLayout(top, BoxLayout.X_AXIS));
		top.setAlignmentX(Component.LEFT_ALIGNMENT);
		top.setPreferredSize(new Dimension(Short.MAX_VALUE, 40));

		top.add(Box.createRigidArea(new Dimension(5, 0)));

		// property label
		JLabel propLabel = new JLabel("Property");
		propLabel.setBounds(10, 20, 40, 20);
		propLabel.setForeground(COLOR_LABEL);
		top.add(propLabel);
		top.add(Box.createRigidArea(new Dimension(5, 0)));

		// add properties combobox
		properties = new JComboBox();
		properties.setMaximumSize(new Dimension(100, 20));
		properties.setMinimumSize(new Dimension(100, 20));
		properties.setPreferredSize(new Dimension(100, 20));
		properties.addItemListener(new ItemListener() {
			public void itemStateChanged(ItemEvent event) {
				String item = (String) event.getItem();
				LinearInterpolator currentValue = (LinearInterpolator) values
						.get(item);
				panel.setInterpolator(currentValue);
			}
		});
		top.add(properties);
		top.add(Box.createRigidArea(new Dimension(10, 0)));

		// min label
		JLabel minLabel = new JLabel("Min");
		minLabel.setMaximumSize(new Dimension(100, 20));
		minLabel.setForeground(COLOR_LABEL);
		top.add(minLabel);
		top.add(Box.createRigidArea(new Dimension(5, 0)));

		// min spinner
		minSpinner = new JSpinner(new SpinnerNumberModel(0, -1000, 1000, 1));
		minSpinner.setMaximumSize(new Dimension(100, 20));
		minSpinner.addChangeListener(new ChangeListener() {
			public void stateChanged(ChangeEvent e) {
				fireUpdated(e.getSource());
			}
		});
		top.add(minSpinner);
		top.add(Box.createRigidArea(new Dimension(5, 0)));

		// max label
		JLabel maxLabel = new JLabel("Max");
		maxLabel.setMaximumSize(new Dimension(100, 20));
		maxLabel.setForeground(COLOR_LABEL);
		top.add(maxLabel);
		top.add(Box.createRigidArea(new Dimension(5, 0)));

		// max spinner
		maxSpinner = new JSpinner(new SpinnerNumberModel(255, -1000, 1000, 1));
		maxSpinner.setMaximumSize(new Dimension(100, 20));
		maxSpinner.addChangeListener(new ChangeListener() {
			public void stateChanged(ChangeEvent e) {
				fireUpdated(e.getSource());
			}
		});
		top.add(maxSpinner);
		top.add(Box.createRigidArea(new Dimension(5, 0)));

		// spacer
		top.add(Box.createHorizontalGlue());

		// value x label
		valueXLabel = new JLabel(TEXT_CURRENT_X);
		valueXLabel.setMaximumSize(new Dimension(100, 20));
		valueXLabel.setForeground(COLOR_LABEL);
		top.add(valueXLabel);
		top.add(Box.createRigidArea(new Dimension(10, 0)));

		// value y label
		valueYLabel = new JLabel(TEXT_CURRENT_Y);
		valueYLabel.setMaximumSize(new Dimension(100, 20));
		valueYLabel.setForeground(COLOR_LABEL);
		top.add(valueYLabel);
		top.add(Box.createRigidArea(new Dimension(10, 0)));

		return top;
	}
469174
protected void layoutCharts() {
        //Pre-sort charts by group column
        MultiValuedMap<DJGroup, DJChart> mmap = new ArrayListValuedHashMap<DJGroup, DJChart>();
        for (DJChart djChart : getReport().getCharts()) {
            mmap.put(djChart.getColumnsGroup(), djChart);
        }

        for (DJGroup key : mmap.keySet()) {
            Collection<DJChart> charts = mmap.get(key);
            List<DJChart> l = new ArrayList<DJChart>(charts);
            //Reverse iteration of the charts to meet insertion order
            for (int i = l.size(); i > 0; i--) {
                DJChart djChart = l.get(i - 1);
                JRDesignChart chart = createChart(djChart);

                //Charts has their own band, so they are added in the band at Y=0
                JRDesignBand band = createGroupForChartAndGetBand(djChart);
                band.addElement(chart);
            }
        }

        //Pre-sort charts by group column
        MultiValuedMap<PropertyColumn, ar.com.fdvs.dj.domain.chart.DJChart> mmap2 = new ArrayListValuedHashMap<PropertyColumn, ar.com.fdvs.dj.domain.chart.DJChart>();
        for (ar.com.fdvs.dj.domain.chart.DJChart djChart : getReport().getNewCharts()) {
            mmap2.put(djChart.getDataset().getColumnsGroup(), djChart);
        }

        for (PropertyColumn key : mmap2.keySet()) {
            Collection<ar.com.fdvs.dj.domain.chart.DJChart> charts = mmap2.get(key);
            ArrayList<ar.com.fdvs.dj.domain.chart.DJChart> l = new ArrayList<ar.com.fdvs.dj.domain.chart.DJChart>(charts);
            //Reverse iteration of the charts to meet insertion order
            for (int i = l.size(); i > 0; i--) {
                ar.com.fdvs.dj.domain.chart.DJChart djChart = l.get(i - 1);
                String name = "chart_" + (i - 1) + new Date().getTime();
                JRDesignChart chart = createChart(djChart, name);

                if (djChart.getLink() != null)
                    HyperLinkUtil.applyHyperLinkToElement((DynamicJasperDesign) getDesign(), djChart.getLink(), chart, name + "_hyperlink");

                //Charts has their own band, so they are added in the band at Y=0
                JRDesignBand band = createGroupForChartAndGetBand(djChart);
                band.addElement(chart);
            }
        }
    }
375588
private JPanel createSorterPane() {
        JPanel insidePanel = new JPanel();
        insidePanel.setLayout(new GridBagLayout());
        preview = new JTableHeader();
        Sortables[] sortables = MainFrame.getInstance().getAvailableSortables();
        preview.setColumnModel(new SorterTableColumnModel(sortables));

        for (Sortables s : sortables) {
            if (s != Sortables.DIVIDER) {
                checkBoxSortList.add(new SortableCheckBox(s));
            }
        }

        setSorterCheckBoxes();

        GridBagConstraints gbc = new GridBagConstraints();
        gbc.fill = GridBagConstraints.BOTH;
        gbc.gridx = 1;
        gbc.insets = new Insets(2,5,2,5);
        insidePanel.add(new JLabel("<html><h2>1. Choose bug properties"), gbc);
        insidePanel.add(new CheckBoxList<>(checkBoxSortList.toArray(new JCheckBox[checkBoxSortList.size()])), gbc);

        JTable t = new JTable(new DefaultTableModel(0, sortables.length));
        t.setTableHeader(preview);
        preview.setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
        insidePanel.add(new JLabel("<html><h2>2. Drag and drop to change grouping priority"), gbc);
        insidePanel.add(createAppropriatelySizedScrollPane(t), gbc);

        sortApply = new JButton(edu.umd.cs.findbugs.L10N.getLocalString("dlg.apply_btn", "Apply"));
        sortApply.addActionListener(e -> {
            MainFrame.getInstance().getSorter().createFrom((SorterTableColumnModel) preview.getColumnModel());
            ((BugTreeModel) MainFrame.getInstance().getTree().getModel()).checkSorter();
            SorterDialog.this.dispose();
        });
        gbc.fill = GridBagConstraints.NONE;
        insidePanel.add(sortApply, gbc);

        JPanel sorter = new JPanel();
        sorter.setLayout(new BorderLayout());
        sorter.add(new JScrollPane(insidePanel), BorderLayout.CENTER);

        return sorter;
    }
649041
public static void applyHyperLinkToElement(DynamicJasperDesign design, DJHyperLink djlink, JRDesignChart chart, String name) {
		JRDesignExpression hlpe = ExpressionUtils.createAndRegisterExpression(design, name, djlink.getExpression());
		chart.setHyperlinkReferenceExpression(hlpe);
		chart.setHyperlinkType( HyperlinkTypeEnum.REFERENCE ); //FIXME Should this be a parameter in the future?
				
		if (djlink.getTooltip() != null){			
			JRDesignExpression tooltipExp = ExpressionUtils.createAndRegisterExpression(design, "tooltip_" + name, djlink.getTooltip());
			chart.setHyperlinkTooltipExpression(tooltipExp);
		}
	}
856901
public static DesignDocument create(final String name, final List<View> views) {
        return create(name, views, new HashMap<Option, Long>());
    }
41005
public String getChartMap(String chartMapId)
			throws IOException
	{
		StringWriter writer = new StringWriter();
		PrintWriter pw = new PrintWriter(writer);

		try
		{
			ChartUtilities.writeImageMap(pw, chartMapId, chartRenderingInfo,
										 new StandardToolTipTagFragmentGenerator(),
										 new StandardURLTagFragmentGenerator());
		}
		finally
		{
			IOUtil.closeQuietly(pw);
		}

		return writer.toString();
	}
671425
protected JcrService createJcrService( Map<String, JcrRepository> jcrRepositories,
                                           CallContext context ) {
        return new JcrService(jcrRepositories);
    }
786413
public DJXYBarChartBuilder addSerie(AbstractColumn column, String label) {
		getDataset().addSerie(column, label);
		return this;
	}
258228
def chart(line, cell=None):
  
  parser = _commands.CommandParser(prog='%chart', description="""
Generate an inline chart using Google Charts using the data in a Table, Query, dataframe, or list.
Numerous types of charts are supported. Options for the charts can be specified in the cell body
using YAML or JSON.
""")
  for chart_type in ['annotation', 'area', 'bars', 'bubbles', 'calendar', 'candlestick', 'columns',
                     'combo', 'gauge', 'geo', 'heatmap', 'histogram', 'line', 'map', 'org',
                     'paged_table', 'pie', 'sankey', 'scatter', 'stepped_area', 'table',
                     'timeline', 'treemap']:
    subparser = parser.subcommand(chart_type, 'Generate a %s chart.' % chart_type)
    subparser.add_argument('-f', '--fields',
                           help='The field(s) to include in the chart')
    subparser.add_argument('-d', '--data',
                           help='The name of the variable referencing the Table or Query to chart',
                           required=True)
    subparser.set_defaults(chart=chart_type)

  parser.set_defaults(func=_chart_cell)
  return _utils.handle_magic_line(line, cell, parser)
954703
public static TaxNumberMapSharedConstants create() {
    if (taxNumberMapConstants == null) { // NOPMD it's thread save!
      synchronized (TaxNumberMapConstants.class) {
        if (taxNumberMapConstants == null) {
          taxNumberMapConstants = GWT.create(TaxNumberMapConstants.class);
        }
      }
    }
    return taxNumberMapConstants;
  }
396018
@Override
    public PropertyWidget<?> create(final ConfiguredPropertyDescriptor propertyDescriptor) {
        // first check if there is a mapping created for this property
        // descriptor
        final PropertyWidget<?> propertyWidget = _propertyWidgetCollection.getMappedPropertyWidget(propertyDescriptor);
        if (propertyWidget != null) {
            return propertyWidget;
        }
        final HiddenProperty hiddenProperty = propertyDescriptor.getAnnotation(HiddenProperty.class);
        if (hiddenProperty != null && hiddenProperty.hiddenForLocalAccess()) {
            return null;
        }
        if (propertyDescriptor.getAnnotation(Deprecated.class) != null) {
            return null;
        }

        if (getComponentBuilder() instanceof AnalyzerComponentBuilder) {
            final AnalyzerComponentBuilder<?> analyzer = (AnalyzerComponentBuilder<?>) getComponentBuilder();
            if (analyzer.isMultipleJobsSupported()) {
                if (analyzer.isMultipleJobsDeterminedBy(propertyDescriptor)) {
                    return new MultipleInputColumnsPropertyWidget(analyzer, propertyDescriptor);
                }
            }
        }

        // check for fitting property widgets by type
        final Class<?> type = propertyDescriptor.getBaseType();

        final Class<? extends PropertyWidget<?>> widgetClass;
        if (propertyDescriptor.isArray()) {
            if (propertyDescriptor.isInputColumn()) {
                widgetClass = MultipleInputColumnsPropertyWidget.class;
            } else if (ReflectionUtils.isString(type)) {
                widgetClass = MultipleStringPropertyWidget.class;
            } else if (type == Dictionary.class) {
                widgetClass = MultipleDictionariesPropertyWidget.class;
            } else if (type == SynonymCatalog.class) {
                widgetClass = MultipleSynonymCatalogsPropertyWidget.class;
            } else if (type == StringPattern.class) {
                widgetClass = MultipleStringPatternPropertyWidget.class;
            } else if (type.isEnum()) {
                widgetClass = MultipleEnumPropertyWidget.class;
            } else if (type == Class.class) {
                widgetClass = MultipleClassesPropertyWidget.class;
            } else if (type == char.class) {
                widgetClass = MultipleCharPropertyWidget.class;
            } else if (ReflectionUtils.isNumber(type)) {
                widgetClass = MultipleNumberPropertyWidget.class;
            } else {
                // not yet implemented
                widgetClass = DummyPropertyWidget.class;
            }
        } else {

            if (propertyDescriptor.isInputColumn()) {
                if (_componentBuilder.getDescriptor().getConfiguredPropertiesByType(InputColumn.class, true).size()
                        == 1) {
                    // if there is only a single input column property, it
                    // will
                    // be displayed using radiobuttons.
                    widgetClass = SingleInputColumnRadioButtonPropertyWidget.class;
                } else {
                    // if there are multiple input column properties, they
                    // will
                    // be displayed using combo boxes.
                    widgetClass = SingleInputColumnComboBoxPropertyWidget.class;
                }
            } else if (ReflectionUtils.isCharacter(type)) {
                widgetClass = SingleCharacterPropertyWidget.class;
            } else if (ReflectionUtils.isString(type)) {
                widgetClass = SingleStringPropertyWidget.class;
            } else if (ReflectionUtils.isBoolean(type)) {
                widgetClass = SingleBooleanPropertyWidget.class;
            } else if (ReflectionUtils.isNumber(type)) {
                widgetClass = SingleNumberPropertyWidget.class;
            } else if (ReflectionUtils.isDate(type)) {
                widgetClass = SingleDatePropertyWidget.class;
            } else if (type == Dictionary.class) {
                widgetClass = SingleDictionaryPropertyWidget.class;
            } else if (type == SynonymCatalog.class) {
                widgetClass = SingleSynonymCatalogPropertyWidget.class;
            } else if (type == StringPattern.class) {
                widgetClass = SingleStringPatternPropertyWidget.class;
            } else if (type.isEnum()) {
                widgetClass = SingleEnumPropertyWidget.class;
            } else if (ReflectionUtils.is(type, Resource.class)) {
                widgetClass = SingleResourcePropertyWidget.class;
            } else if (type == File.class) {
                widgetClass = SingleFilePropertyWidget.class;
            } else if (type == Pattern.class) {
                widgetClass = SinglePatternPropertyWidget.class;
            } else if (ReflectionUtils.is(type, Datastore.class)) {
                widgetClass = SingleDatastorePropertyWidget.class;
            } else if (type == Class.class) {
                widgetClass = SingleClassPropertyWidget.class;
            } else if (type == Map.class) {
                final Class<?> genericType1 = propertyDescriptor.getTypeArgument(0);
                final Class<?> genericType2 = propertyDescriptor.getTypeArgument(1);
                if (genericType1 == String.class && genericType2 == String.class) {
                    widgetClass = MapStringToStringPropertyWidget.class;
                } else {
                    // not yet implemented
                    widgetClass = DummyPropertyWidget.class;
                }
            } else {
                // not yet implemented
                widgetClass = DummyPropertyWidget.class;
            }
        }

        final Injector injector = getInjectorForPropertyWidgets(propertyDescriptor);
        return injector.getInstance(widgetClass);
    }