lt.monarch.chart.spc
Class HistogramChart

java.lang.Object
  extended by lt.monarch.chart.AbstractView<PaintTags>
      extended by lt.monarch.chart.AbstractChart<PaintTags,GeneralProjector>
          extended by lt.monarch.chart.MultiSeriesChartBase<ChartPaintTags,Projector2D>
              extended by lt.monarch.chart.chart2D.Chart2D
                  extended by lt.monarch.chart.spc.SpcChart
                      extended by lt.monarch.chart.spc.HistogramChart
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Chart<Projector2D>, ChartEntity, StyleEditorEntity, View
Direct Known Subclasses:
CpkChart

public class HistogramChart
extends SpcChart

Histogram chart. Displays data divided into groups as a bar chart. Contains specified LSL and USL marker lines and the fitted normal distribution curve onto histogram bars. Values are calculated using formulas: http://www.singleton-labs.com/doc/mcharts/guide/#guide/chart-types/4.5.1.html

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
protected  ChartDataModel barsDataModel
           
protected  HistogramValuesCalculator calc
           
protected  int groupsCount
           
protected  BarSeries histogramBarSeries
           
protected  TextMarker infoMarker
           
protected  LineSeries line
           
protected  ChartDataModel lineDataModel
           
protected  java.lang.Double lsl
           
protected  VerticalMarkerLine lslMarkerLine
           
protected  VerticalMarkerLine meanMarkerLine
           
protected  java.text.NumberFormat nf
           
protected  java.lang.Double usl
           
protected  VerticalMarkerLine uslMarkerLine
           
protected  MathAxisMapper xMapper
           
protected  LabelAxisMapper xMapperLabel
           
protected  MathAxisMapper yMapperLeft
           
protected  MathAxisMapper yMapperRight
           
 
Fields inherited from class lt.monarch.chart.spc.SpcChart
bottomAxis, dataModel, grid, leftAxis, rightAxis
 
Fields inherited from class lt.monarch.chart.chart2D.Chart2D
projector
 
Fields inherited from class lt.monarch.chart.AbstractChart
draftMode, locale, plugins
 
Fields inherited from class lt.monarch.chart.AbstractView
layoutInvalid, paintStyle, style
 
Constructor Summary
Constructor and Description
HistogramChart(ChartDataModel dataModel, int groupsCount)
          Constructs histogram chart without LSL and USL lines
HistogramChart(ChartDataModel dataModel, int groupsCount, java.lang.Double lsl, java.lang.Double usl)
          Constructs histogram chart with LSL and USL lines
 
Method Summary
Modifier and Type Method and Description
protected  lt.monarch.chart.spc.ChartBounds getBounds(double mean, double std, java.util.List<BinCenter> binCenters, double binWidth)
           
 LineSeries getDistributionCurveSeries()
          Returns normal distribution curve.
 int getGroupsCount()
          Returns value showing how many bins histogram contains.
 BarSeries getHistogramBarSeries()
          Returns histogram bar series.
 TextMarker getInfoMarker()
          Returns information marker.
protected  java.lang.String getInfoMarkerText(double mean, double std)
          Returns string value for info marker.
 java.lang.Double getLsl()
          Returns lower specification limit
 VerticalMarkerLine getLslMarkerLine()
          Returns lower specification limit marker line use setVisible(false) to hide it.
 VerticalMarkerLine getMeanMarkerLine()
          Returns mean value marker.
 java.lang.Double getUsl()
          Returns upper specification limit
 VerticalMarkerLine getUslMarkerLine()
          Returns upper specification limit marker line Use setVisible(false) to hide it.
 void setChartData(ChartDataModel dataModel, int groupsCount, java.lang.Double lsl, java.lang.Double usl)
          Sets all histogram chart data with LSL and USL lines
 void setGroupsCount(int groupsCount)
          Sets value showing how many bins histogram has to contain Recommended values: Number of Data Points Number of groups < 50 5--7 50--100 6--10 101--250 7--12 > 250 10--20
 void setLsl(java.lang.Double lsl)
          Sets lower specification limit
 void setUsl(java.lang.Double usl)
          Sets upper specification limit
protected  void updateAxes()
          Creates chart axes on chart initialization.
protected  void updateChart()
          Redraws chart
protected  void updateGrid()
          Creates chart grid on chart creation.
protected  void updateHistogramSeries(java.util.List<BinCenter> binCenters)
          Creates histogram series on chart creation or updates them on chart data model change.
protected  void updateInfoMarker(double minx, double max, double diff, double mean, double std)
          Creates string value of text marker on chart creation or updates it on chart data model change.
protected  void updateLineSeries(lt.monarch.chart.spc.ChartBounds bounds, double mean, double std, double area)
          Creates lines series on chart creation or updates them on chart data model change.
protected  void updateLslMarkerLine()
          Creates lower specification level marker line on chart creation or updates it on chart data model change.
protected  void updateMappers(lt.monarch.chart.spc.ChartBounds bounds, java.util.List<BinCenter> binCenters, int dataCount)
           
protected  void updateMeanMarkerLine(double mean)
          Creates mean marker line on chart creation or updates it on chart data model change.
protected  void updateUslMarkerLine()
          Creates upper specification level marker line on chart creation or updates it on chart data model change.
 
Methods inherited from class lt.monarch.chart.spc.SpcChart
getBottomAxis, getDataModel, getGrid, getLeftAxis, getMax, getMax, getMin, getMin, getRightAxis, resetDataModel, setDataModel, setNoData, setNoData, trim
 
Methods inherited from class lt.monarch.chart.chart2D.Chart2D
addBottomXAxis, addLeftYAxis, addRightYAxis, addTopXAxis, addXAxis, addYAxis, dispose, finalize, getBreakLine, getChartAreaMargin, getMinAxisWidth, getProjector, getStackedXAxisMargin, getStackedYAxisMargin, getXAxes, getYAxes, layout, paintChart, projector, removeBottomXAxis, removeLeftYAxis, removeRightYAxis, removeTopXAxis, removeXAxis, removeYAxis, setBottomXAxis, setBreakLine, setChartAreaMargin, setLeftYAxis, setMinAxisWidth, setRightYAxis, setStackedBottomXAxisProportion, setStackedLeftYAxisProportion, setStackedRightYAxisProportion, setStackedTopXAxisProportion, setStackedXAxisMargin, setStackedXAxisProportion, setStackedYAxisMargin, setStackedYAxisProportion, setTopXAxis, setXAxis, setXAxis, setYAxis, setYAxis
 
Methods inherited from class lt.monarch.chart.MultiSeriesChartBase
activate, addObject, createLegendEntries, deactivate, findObject, getContainingObjects, getObjects, layoutObjects, removeObject, replaceObject, reset, setObjects, shiftObjects
 
Methods inherited from class lt.monarch.chart.AbstractChart
addPlugin, disableDrafMode, enableDraftMode, fillEntitySheet, getDescription, getLocale, getParentEntity, getPlugins, getShortDescription, invalidate, isDraftMode, paint, removePlugin, removePlugins, setDraftMode, setLocale
 
Methods inherited from class lt.monarch.chart.AbstractView
addViewListener, clone, container, getAlignmentX, getAlignmentY, getBounds, getChartObjectBounds, getContainer, getGraphicsType, getHeight, getMaximumSize, getMinimumSize, getPaintMode, getPaintStyle, getParent, getPreferredSize, getSize, getSize, getStyle, getStyle, getWidth, getX, getY, isLayoutValid, removeViewListener, render, repaint, repaint, setAlignmentX, setAlignmentY, setBounds, setBounds, setContainer, setLocation, setMaximumSize, setMinimumSize, setPaintMode, setPreferredSize, setSize, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface lt.monarch.chart.engine.View
addViewListener, clone, container, getAlignmentX, getAlignmentY, getBounds, getGraphicsType, getHeight, getMaximumSize, getMinimumSize, getPreferredSize, getSize, getSize, getStyle, getWidth, getX, getY, removeViewListener, render, repaint, repaint, setAlignmentX, setAlignmentY, setBounds, setBounds, setContainer, setLocation, setMaximumSize, setMinimumSize, setPreferredSize, setSize, validate
 

Field Detail

uslMarkerLine

protected VerticalMarkerLine uslMarkerLine

lslMarkerLine

protected VerticalMarkerLine lslMarkerLine

meanMarkerLine

protected VerticalMarkerLine meanMarkerLine

nf

protected java.text.NumberFormat nf

barsDataModel

protected ChartDataModel barsDataModel

lineDataModel

protected ChartDataModel lineDataModel

infoMarker

protected TextMarker infoMarker

lsl

protected java.lang.Double lsl

usl

protected java.lang.Double usl

xMapper

protected MathAxisMapper xMapper

histogramBarSeries

protected BarSeries histogramBarSeries

line

protected LineSeries line

yMapperLeft

protected MathAxisMapper yMapperLeft

yMapperRight

protected MathAxisMapper yMapperRight

xMapperLabel

protected LabelAxisMapper xMapperLabel

calc

protected HistogramValuesCalculator calc

groupsCount

protected int groupsCount
Constructor Detail

HistogramChart

public HistogramChart(ChartDataModel dataModel,
                      int groupsCount)
               throws DataFormatException
Constructs histogram chart without LSL and USL lines

Parameters:
dataModel - histogram data
groupsCount - bins count
Throws:
DataFormatException

HistogramChart

public HistogramChart(ChartDataModel dataModel,
                      int groupsCount,
                      java.lang.Double lsl,
                      java.lang.Double usl)
               throws DataFormatException
Constructs histogram chart with LSL and USL lines

Parameters:
dataModel - histogram data
groupsCount - bins count
lsl - LSL value
usl - USL value
Throws:
DataFormatException
Method Detail

setChartData

public void setChartData(ChartDataModel dataModel,
                         int groupsCount,
                         java.lang.Double lsl,
                         java.lang.Double usl)
                  throws DataFormatException
Sets all histogram chart data with LSL and USL lines

Parameters:
dataModel - histogram data
groupsCount - bins count
lsl - LSL value
usl - USL value
Throws:
DataFormatException

updateChart

protected void updateChart()
                    throws DataFormatException
Description copied from class: SpcChart
Redraws chart

Overrides:
updateChart in class SpcChart
Throws:
DataFormatException

updateLineSeries

protected void updateLineSeries(lt.monarch.chart.spc.ChartBounds bounds,
                                double mean,
                                double std,
                                double area)
Creates lines series on chart creation or updates them on chart data model change.


updateGrid

protected void updateGrid()
Creates chart grid on chart creation.


updateAxes

protected void updateAxes()
Creates chart axes on chart initialization.


updateMappers

protected void updateMappers(lt.monarch.chart.spc.ChartBounds bounds,
                             java.util.List<BinCenter> binCenters,
                             int dataCount)

updateLslMarkerLine

protected void updateLslMarkerLine()
Creates lower specification level marker line on chart creation or updates it on chart data model change.


updateUslMarkerLine

protected void updateUslMarkerLine()
Creates upper specification level marker line on chart creation or updates it on chart data model change.


updateMeanMarkerLine

protected void updateMeanMarkerLine(double mean)
Creates mean marker line on chart creation or updates it on chart data model change.


updateInfoMarker

protected void updateInfoMarker(double minx,
                                double max,
                                double diff,
                                double mean,
                                double std)
                         throws DataFormatException
Creates string value of text marker on chart creation or updates it on chart data model change.

Parameters:
minx -
max -
diff -
mean -
std -
Throws:
DataFormatException

getInfoMarkerText

protected java.lang.String getInfoMarkerText(double mean,
                                             double std)
                                      throws DataFormatException
Returns string value for info marker. This value is compound of two values - mean and standard deviation.

Parameters:
mean -
std -
Returns:
Throws:
DataFormatException

updateHistogramSeries

protected void updateHistogramSeries(java.util.List<BinCenter> binCenters)
Creates histogram series on chart creation or updates them on chart data model change.


getBounds

protected lt.monarch.chart.spc.ChartBounds getBounds(double mean,
                                                     double std,
                                                     java.util.List<BinCenter> binCenters,
                                                     double binWidth)

getDistributionCurveSeries

public LineSeries getDistributionCurveSeries()
Returns normal distribution curve. Use setVisible(false) to hide it.


getLsl

public java.lang.Double getLsl()
Returns lower specification limit


setLsl

public void setLsl(java.lang.Double lsl)
            throws DataFormatException
Sets lower specification limit

Throws:
DataFormatException

getUsl

public java.lang.Double getUsl()
Returns upper specification limit


setUsl

public void setUsl(java.lang.Double usl)
            throws DataFormatException
Sets upper specification limit

Throws:
DataFormatException

getGroupsCount

public int getGroupsCount()
Returns value showing how many bins histogram contains.


setGroupsCount

public void setGroupsCount(int groupsCount)
                    throws DataFormatException
Sets value showing how many bins histogram has to contain Recommended values: Number of Data Points Number of groups < 50 5--7 50--100 6--10 101--250 7--12 > 250 10--20

Throws:
DataFormatException

getHistogramBarSeries

public BarSeries getHistogramBarSeries()
Returns histogram bar series. Use setVisible(false) to hide it.


getUslMarkerLine

public VerticalMarkerLine getUslMarkerLine()
Returns upper specification limit marker line Use setVisible(false) to hide it.


getLslMarkerLine

public VerticalMarkerLine getLslMarkerLine()
Returns lower specification limit marker line use setVisible(false) to hide it.


getInfoMarker

public TextMarker getInfoMarker()
Returns information marker. Use setVisible(false) to hide it.


getMeanMarkerLine

public VerticalMarkerLine getMeanMarkerLine()
Returns mean value marker. Use setVisible(false) to hide it.