jfreechart

How to customize a tooltip of CategoryPlot items in JFreeChart?

﹥>﹥吖頭↗ 提交于 2019-12-17 20:15:58
问题 I need to change the format of the default tooltip in the bars drawn in the plot of a chart. I don't know if my direction of looking at the problem is right. I am looking at the default format for the class StandardCategoryToolTipGenerator that is DEFAULT_TOOL_TIP_FORMAT_STRING = "({0}, {1}) = {2}" How can I redefine this value? Thanks in advance. 回答1: The StandardCategoryToolTipGenerator sets the MessageFormat ArgumentIndex values to the series , category and value . Try this example on your

How i can use jfreeChart with Javafx2

和自甴很熟 提交于 2019-12-17 19:32:31
问题 For a JavaFX2 Application I have to show different types of Charts.I am using jfreeChart for Charts creation and code given below: public static JFreeChart generatePieChart() { DefaultPieDataset dataSet = new DefaultPieDataset(); dataSet.setValue("China", 25); dataSet.setValue("India", 25); dataSet.setValue("United States", 50); JFreeChart chart = ChartFactory.createPieChart( "World Population by countries", dataSet, true, true, false); return chart; } This returns me a chart object. How can

JFreeChart different colors in different regions for the same dataSeries

喜欢而已 提交于 2019-12-17 19:25:57
问题 In JFreeChart I'm trying to color different regions of an XY line chart/curve based on y value. I'm overriding the XYLineAndShapeRenderer 's getItemPaint(int row, int col) , however I'm not sure how it handles the coloring of the line between the x s since it's only getting itemPaint on the x (integer values). final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer() { @Override @Override public Paint getItemPaint(int row, int col) { System.out.println(col+","+dataset.getY(row, col

Making dynamic line chart using jfree chart in java

拈花ヽ惹草 提交于 2019-12-17 19:10:34
问题 how can i create dynamic line chart using jFree chart in java which is show data of 2 hours before and also provide a blank space where data show for 2 hours later from current time.For example suppose current time is 4pm ,so the chart display data from 2pm to 6pm.Here 2pm to 4pm the chart show a line and 4pm to 6pm provide a blank space which is fill time to time when the graph is moving that mean the tail of this graph is starting from middle and move right. similar like stock market chart.

Width of the bar in Jfreechart

半世苍凉 提交于 2019-12-17 18:39:10
问题 Is there a way to adjust the width of the bars in a Barchart? I create my chart with the following code. final JFreeChart chart = ChartFactory.createBarChart("Report", // chart title "Date", // domain axis label "Number", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? ); 回答1: You can also set the maximum width of a bar. This is useful if you have a wide chart but occasionally there are only one or two

How to change the TimeSeries and TimeSeriesCollection to XYSeries and XYCollection respectively in java?

流过昼夜 提交于 2019-12-17 17:11:49
问题 Based on this example, this code is for draging the point in the chart. I want to replace TimeSeries object with XYSeries because I dont want the months in X-axis; I want the series of number like Point1 , Point2 , Point3 and so on, and want the same logic. When replacing with XYSeries I am not getting how to change the logic for XYSeries . package com.example.java; import org.jfree.chart.*; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.entity.ChartEntity; import org.jfree

How can I change the tickLabel on a NumberAxis in JFreeChart?

左心房为你撑大大i 提交于 2019-12-17 17:04:56
问题 I am using JFreeChart and want to be able to change the label on the range axis from a number to something more meaningful for the domain I am in. I only see options for customizing the look of the label and no way to override the content of the label based on the position of the tick. Does anyone know how to override the text of the tickLabel? 回答1: The JFreeChart BarChartDemo1 shows how to use the setStandardTickUnits() method. NumberAxis has several handy static factories for this. To

Update graph with JFreeChart and slider

房东的猫 提交于 2019-12-17 16:49:09
问题 I have a time history for arrays describing the pressure along a pipe. So I have an array of pressure values along the length of the pipe for each delta t. I want to plot the pressures along the length of the pipe with JFreeChart and chose which delta t to plot with a slider, so that whenever the user moves the slider the graphic is updates with values from a different delta t. I'm also resetting the tile to be the pressure at the last portion of the pipe. What happens is that the title is

Need help to open a subchart from a main chart?

落花浮王杯 提交于 2019-12-17 15:01:50
问题 I have the following chart: Now my problem is I want to open a new chart containing the information for Linux OS when a user clicks on Linux portion of chart, shown in red. I have tried this: //check if Linux OS is clicked on chart... if("Linux".equals(chartMouseEvent.getEntity().getToolTipText())) { //open new chart having the information for Linux } But I think there may be some better alternate to do the same job. So please help if you know how to achieve this. 回答1: ChartEntity is a good

Plotting multiple regression lines through different Y-Intercepts and X-values

∥☆過路亽.° 提交于 2019-12-17 14:56:53
问题 I am trying to through a linear regression line through individual separate clusters of data that share the same slope. However, though I have successfully plotted differing colors for the points themselves and graphed those successfully, my attempt at the line is not working. Earlier I tried a hashset that ran through calling out the clusters by colors but that caused issues with the order in which the lines came in. In this attempt, I tried to link the clusters through a number attachment