question: public void drawLinesAndPoints ( Graphics2D g2d , ArrayList < ComparableLabel > orderedDateSet , HashMap < ComparableLabel , Integer > dataPoints , long yMaxMark ) { int sectionWidth = this . graphWidth / orderedDateSet . size ( ) ; int xOffset = sectionWidth / 2 ; int yPrevValue ; int yCurrentValue ; float prevOffsetPerc ; float currentOffsetPerc ; g2d . setColor ( this . lineColor ) ; for ( int i = 0 ; i < orderedDateSet . size ( ) ; i ++ ) { if ( i != 0 ) { yPrevValue = dataPoints . get ( orderedDateSet . get ( i - 1 ) ) ; yCurrentValue = dataPoints . get ( orderedDateSet . get ( i ) ) ; prevOffsetPerc = yPrevValue / ( float ) yMaxMark ; currentOffsetPerc = yCurrentValue / ( float ) yMaxMark ; g2d . drawLine ( this . graphLeft + ( i - 1 ) * sectionWidth + xOffset , this . graphBottom - Math . round ( prevOffsetPerc * this . graphHeight ) , this . graphLeft + i * sectionWidth + xOffset , Math . round ( this . graphBottom - currentOffsetPerc * this . graphHeight ) ) ; } else { yCurrentValue = dataPoints . get ( orderedDateSet . get ( i ) ) ; currentOffsetPerc = yCurrentValue / ( float ) yMaxMark ; g2d . fillOval ( this . graphLeft + ( i ) * sectionWidth + xOffset - this . pointRadius , this . graphBottom - Math . round ( currentOffsetPerc * this . graphHeight ) - this . pointRadius , this . pointRadius * 2 , this . pointRadius * 2 ) ; } } }
target:  draws the datapoints and the lines connecting the datapoints on the line graph