Jump to content
Software FX Community

Creating a truly borderless chart


mcstoufer

Recommended Posts

I am trying to generate a 'trend chart'. Attached is a small version. Part of the spec I have to work with is that there be NO visible border of any kind around the plot. As you can see, I have only the outside border line to remove. I have poured over the docs and do not see how this last bit is resolved. I am generating the image via JSF Managed Bean. The two related methods are below.

 

public void setChartComp(com.softwarefx.chartfxfaces.component.Chart chartComp) {   trend = chartComp;   }   public com.softwarefx.chartfxfaces.component.Chart getChartComp() {   java.util.Random r = new java.util.Random(1);   trend.setGallery(Gallery.LINES);   trend.setMarkerShape(MarkerShape.NONE);   SoftwareFX.ChartFX.DefaultBorder myBorder = new SoftwareFX.ChartFX.DefaultBorder(BorderType.NONE);   myBorder.setColor(java.awt.Color.WHITE);   trend.setBorderObject(myBorder);   trend.setBackColor(java.awt.Color.WHITE);   trend.setBottomGap(0);   trend.setLeftGap(0);   trend.setTopGap(0);   trend.setRightGap(0);//Populating the chart with random data   trend.openData(COD.VALUES, 1, 12);   for (int j = 0; j < 12; j++) {   trend.getValue().setItem(0, j, r.nextDouble() * 50);   }   trend.closeData(COD.VALUES);   trend.getAxisX().setVisible(false);   trend.getAxisY().setVisible(false);   return trend;   }

Link to comment
Share on other sites

I've made some progress here. I have removed the inner border but can't figure out how to change the bounding rectangle so it consumes the entire area of the image. This is now related to the previous thread on maximizing plot space in a chart.

 Here is the updated getChartComp() method that has the improvements:

 Note the "setAxesStyle" call.

public com.softwarefx.chartfxfaces.component.Chart getChartComp() {   java.util.Random r = new java.util.Random(1);   trend.setGallery(Gallery.LINES);   trend.setMarkerShape(MarkerShape.NONE);   trend.setAxesStyle(AxesStyle.NONE);   SoftwareFX.ChartFX.DefaultBorder myBorder =   new SoftwareFX.ChartFX.DefaultBorder(BorderType.NONE,java.awt.Color.WHITE);   trend.setBorderObject(myBorder);   trend.setBackColor(java.awt.Color.WHITE);   trend.setBottomGap(0);   trend.setLeftGap(0);   trend.setTopGap(0);   trend.setRightGap(0);   trend.openData(COD.VALUES, 1, 12);   for (int j = 0; j < 12; j++) {   trend.getValue().setItem(0, j, r.nextDouble() * 50);   }   trend.closeData(COD.VALUES);   trend.getAxisX().setVisible(false);   trend.getAxisY().setVisible(false);   return trend;   } 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...