CXTPChartRectF CXTPChartRangeBarSeriesPointView::GetScreenRect() const { CXTPChartRangeBarSeriesView* pSeriesView = (CXTPChartRangeBarSeriesView*)GetSeriesView(); CXTPChartRangeBarSeriesStyle* pSeriesStyle = (CXTPChartRangeBarSeriesStyle*)GetSeriesView()->GetStyle(); CXTPChartAxisView* pAxisXView = pSeriesView->GetAxisViewX(); if (pSeriesView->m_nBarIndex != -1) { int nCount = pSeriesView->m_nBarCount; int nIndex = pSeriesView->m_nBarIndex; double dOffset = (1 + pSeriesStyle->GetBarDistanceFixed()) / pAxisXView->GetScale(); double dRangeBarWidth = (pSeriesStyle->GetBarWidth() - dOffset * (nCount - 1)) / nCount; CXTPChartPointF ptTopLeft(pSeriesView->GetScreenPoint(m_pPoint->GetInternalArgumentValue() - pSeriesStyle->GetBarWidth() / 2 + dRangeBarWidth * nIndex + dOffset * nIndex, m_pPoint->GetValue(0))); CXTPChartPointF ptBottomRight(pSeriesView->GetScreenPoint(m_pPoint->GetInternalArgumentValue() - pSeriesStyle->GetBarWidth() / 2 + dRangeBarWidth * nIndex + dOffset * nIndex + dRangeBarWidth, m_pPoint->GetValue(1))); CXTPChartRectF rc(ptTopLeft, ptBottomRight); rc.Width++; rc.Height++; return rc; } return CXTPChartRectF(0, 0, 0, 0); }
CXTPChartDeviceCommand* CXTPChartHighLowSeriesPointView::CreateDeviceCommand(CXTPChartDeviceContext* pDC) { UNREFERENCED_PARAMETER(pDC); CPoint pointOpen = GetScreenPoint(chartOpen).Round(); CPoint pointClose = GetScreenPoint(chartClose).Round(); CPoint pointLow = GetScreenPoint(chartLow).Round(); CPoint pointHight = GetScreenPoint(chartHigh).Round(); BOOL bUpColor = TRUE; CXTPChartSeriesPoint* pPrevPoint = m_pPoint->GetPreviousPoint(); if (pPrevPoint) { if (pPrevPoint->GetValue(chartClose) > m_pPoint->GetValue(chartClose)) { bUpColor = FALSE; } } CXTPChartHighLowSeriesView* pView = (CXTPChartHighLowSeriesView*)GetSeriesView(); CXTPChartAxisView* pAxisView = pView->GetAxisViewX(); CXTPChartHighLowSeriesStyle* pStyle = (CXTPChartHighLowSeriesStyle*)GetSeriesView()->GetStyle(); int nWidth = (int)(pAxisView->DistanceToPoint(1) * 0.5); if (nWidth < 5) nWidth = 5; int nLineThickness = pStyle->GetLineThickness(); nWidth = (nWidth & ~1) + nLineThickness * 3; CXTPChartDeviceCommand* pCommand = new CXTPChartHitTestElementCommand(m_pPoint); CXTPChartColor color = bUpColor ? pStyle->GetUpColor() : pStyle->GetDownColor(); pCommand->AddChildCommand(new CXTPChartSolidLineDeviceCommand( CXTPChartPointF(pointHight), CXTPChartPointF(pointLow), color, nLineThickness)); pCommand->AddChildCommand(new CXTPChartSolidLineDeviceCommand( CXTPChartPointF(pointOpen), CXTPChartPointF((float)(pointOpen.x - nWidth / 2), (float)pointOpen.y), color, nLineThickness)); pCommand->AddChildCommand(new CXTPChartSolidLineDeviceCommand( CXTPChartPointF(pointClose), CXTPChartPointF((float)(pointClose.x + nWidth / 2), (float)pointClose.y), color, nLineThickness)); return pCommand; }
CXTPChartDeviceCommand* CXTPChartPyramidSeriesPointView::CreateDeviceCommand(CXTPChartDeviceContext* pDC) { UNREFERENCED_PARAMETER(pDC); CXTPChartColor color1 = GetColor(); CXTPChartColor color2 = GetColor2(); CXTPChartColor clrBorder = GetBorderActualColor(); CXTPChartDeviceCommand* pCommand = new CXTPChartHitTestElementCommand(m_pPoint); CXTPChartPyramidSeriesStyle* pStyle = STATIC_DOWNCAST(CXTPChartPyramidSeriesStyle, GetSeriesView()->GetStyle()); CXTPChartPoints arrPoints; arrPoints.Add(CXTPChartPointF(m_rc.GetLeft() + int((m_rc.Width - m_rc.Width * m_dFrom) / 2), m_rc.GetTop())); arrPoints.Add(CXTPChartPointF(m_rc.GetLeft() + int((m_rc.Width + m_rc.Width * m_dFrom) / 2), m_rc.GetTop())); arrPoints.Add(CXTPChartPointF(m_rc.GetLeft() + int((m_rc.Width + m_rc.Width * m_dTo) / 2), m_rc.GetBottom())); arrPoints.Add(CXTPChartPointF(m_rc.GetLeft() + int((m_rc.Width - m_rc.Width * m_dTo) / 2), m_rc.GetBottom())); pCommand->AddChildCommand(pStyle->GetFillStyle()->CreateDeviceCommand(arrPoints, color1, color2)); if (pStyle->GetBorder()->IsVisible()) pCommand->AddChildCommand(new CXTPChartBoundedPolygonDeviceCommand(arrPoints, clrBorder, pStyle->GetBorder()->GetThickness())); return pCommand; }
CXTPChartRectF CXTPChartStackedBarSeriesPointView::GetScreenRect() const { CXTPChartStackedBarSeriesView* pSeriesView = (CXTPChartStackedBarSeriesView*)GetSeriesView(); CXTPChartStackedBarSeriesStyle* pSeriesStyle = STATIC_DOWNCAST(CXTPChartStackedBarSeriesStyle, GetSeriesView()->GetStyle()); CXTPChartAxisView* pAxisXView = pSeriesView->GetAxisViewX(); if (pSeriesView->m_nBarIndex != -1) { int nCount = pSeriesView->m_nBarCount; int nIndex = pSeriesView->m_nBarIndex; double dOffset = 3 / pAxisXView->GetScale(); double dBarWidth = (pSeriesStyle->GetBarWidth() - dOffset * (nCount - 1)) / nCount; CXTPChartPointF ptTopLeft(pSeriesView->GetScreenPoint(m_pPoint->GetInternalArgumentValue() - pSeriesStyle->GetBarWidth() / 2 + dBarWidth * nIndex + dOffset * nIndex, m_dValueTo)); CXTPChartPointF ptBottomRight(pSeriesView->GetScreenPoint(m_pPoint->GetInternalArgumentValue() - pSeriesStyle->GetBarWidth() / 2 + dBarWidth * nIndex + dOffset * nIndex + dBarWidth, m_dValueFrom)); CXTPChartRectF rc(ptTopLeft, ptBottomRight); rc.Width++; rc.Height++; return rc; } return CXTPChartRectF(0, 0, 0, 0); }
CXTPChartDeviceCommand* CXTPChartPyramidSeriesPointView::CreateLegendDeviceCommand(CXTPChartDeviceContext* pDC, CRect rcBounds) { CXTPChartColor color1 = GetColor(); CXTPChartColor color2 = GetColor2(); CXTPChartColor clrBorder = GetBorderActualColor(); return ((CXTPChartPyramidSeriesView*)GetSeriesView())->CreateLegendDeviceCommand(pDC, rcBounds, color1, color2, clrBorder); }
CXTPChartColor CXTPChartPyramidSeriesPointView::GetBorderActualColor() const { CXTPChartPyramidSeriesStyle* pStyle = STATIC_DOWNCAST(CXTPChartPyramidSeriesStyle, GetSeriesView()->GetStyle()); if (!pStyle->GetBorder()->GetColor().IsEmpty()) return pStyle->GetBorder()->GetColor(); CXTPChartColor clr = GetColor().GetDarkColor(); return clr; }
CXTPChartDeviceCommand* CXTPChartRangeBarSeriesPointView::CreateDeviceCommand(CXTPChartDeviceContext* pDC) { CXTPChartDeviceCommand* pCommand = CXTPChartBarSeriesPointView::CreateDeviceCommand(pDC); CXTPChartColor color = GetColor(); CXTPChartColor color2 = GetColor2(); CXTPChartColor colorBorder = GetColor().GetDarkColor(); CXTPChartPointF point = GetScreenPoint(TRUE); pCommand->AddChildCommand(((CXTPChartRangeBarSeriesStyle*)GetSeriesView()->GetStyle())->GetMinValueMarker()->CreateDeviceCommand(pDC, point, color, color2, colorBorder)); point = GetScreenPoint(FALSE); pCommand->AddChildCommand(((CXTPChartRangeBarSeriesStyle*)GetSeriesView()->GetStyle())->GetMaxValueMarker()->CreateDeviceCommand(pDC, point, color, color2, colorBorder)); return pCommand; }
CXTPChartColor CXTPChartSeriesPointView::GetColor2() const { CXTPChartSeriesView* pSeriesView = GetSeriesView(); if (!m_pPoint->GetColor().IsEmpty()) return CXTPChartAppearance::GetLightColor(m_pPoint->GetColor()); if (pSeriesView->GetStyle()->IsColorEach()) return pSeriesView->GetSeries()->GetContent()->GetAppearance()->GetPalette()->GetColor2(m_pPoint->GetPaletteIndex()); return pSeriesView->GetColor2(); }
void CXTPChartPyramidSeriesPointView::CalculateLayout(int nIndex, int nCount, double dFrom, double dTo) { CXTPChartPyramidSeriesView* pView = (CXTPChartPyramidSeriesView*)GetSeriesView(); CXTPChartPyramidSeriesStyle* pStyle = STATIC_DOWNCAST(CXTPChartPyramidSeriesStyle, GetSeriesView()->GetStyle()); CXTPChartRectF rcInnerRect = pView->GetInnerBounds(); m_rc.X = rcInnerRect.X; m_rc.Y = (float)CXTPChartMathUtils::Round(rcInnerRect.Y + rcInnerRect.Height * dFrom); int bottom = (int)CXTPChartMathUtils::Round(rcInnerRect.Y + rcInnerRect.Height * dTo); if (nIndex != nCount -1) bottom -= pStyle->GetPointDistance(); m_rc.Height = max(1.0f, bottom - m_rc.Y); m_rc.Width = rcInnerRect.Width; m_dFrom = (m_rc.Y - rcInnerRect.Y) / rcInnerRect.Height; m_dTo = ((m_rc.Y + m_rc.Height) - rcInnerRect.Y) / rcInnerRect.Height; }
CXTPChartPointF CXTPChartRangeBarSeriesPointView::GetScreenPoint(BOOL bMinValue) const { CXTPChartRangeBarSeriesView* pSeriesView = (CXTPChartRangeBarSeriesView*)GetSeriesView(); CXTPChartRangeBarSeriesStyle* pSeriesStyle = (CXTPChartRangeBarSeriesStyle*)GetSeriesView()->GetStyle(); CXTPChartAxisView* pAxisXView = pSeriesView->GetAxisViewX(); if (pSeriesView->m_nBarIndex != -1) { int nCount = pSeriesView->m_nBarCount; int nIndex = pSeriesView->m_nBarIndex; double dOffset = (1 + pSeriesStyle->GetBarDistanceFixed()) / pAxisXView->GetScale(); double dRangeBarWidth = (pSeriesStyle->GetBarWidth() - dOffset * (nCount - 1)) / nCount; CXTPChartPointF pt(pSeriesView->GetScreenPoint(m_pPoint->GetInternalArgumentValue() - pSeriesStyle->GetBarWidth() / 2 + dRangeBarWidth / 2 + dRangeBarWidth * nIndex + dOffset * nIndex, m_pPoint->GetValue(bMinValue ? 0 : 1))); return pt; } return CXTPChartPointF(0, 0); }
CXTPChartDeviceCommand* CXTPChartPointSeriesPointView::CreateLegendDeviceCommand(CXTPChartDeviceContext* pDC, CRect rcBounds) { UNREFERENCED_PARAMETER(pDC); rcBounds.DeflateRect(1, 1, 2, 2); CXTPChartDeviceCommand* pCommand = new CXTPChartDeviceCommand(); CXTPChartPointSeriesStyle* pStyle = STATIC_DOWNCAST(CXTPChartPointSeriesStyle, GetSeriesView()->GetSeries()->GetStyle()); CXTPChartPointF ptCenter(rcBounds.CenterPoint().x, rcBounds.CenterPoint().y) ; int nSize = min(rcBounds.Width(), rcBounds.Height()); pCommand->AddChildCommand(pStyle->GetMarker()->CreateDeviceCommand(pDC, ptCenter, nSize, GetColor(), GetColor2(), GetColor().GetDarkColor())); return pCommand; }
CXTPChartDeviceCommand* CXTPChartPointSeriesPointView::CreateDeviceCommand(CXTPChartDeviceContext* pDC) { CXTPChartColor color = GetColor(); CXTPChartColor color2 = GetColor2(); CXTPChartColor colorBorder = GetColor().GetDarkColor(); if (CXTPChartMathUtils::IsNan(m_dInternalValue)) return NULL; CXTPChartDeviceCommand* pCommand = new CXTPChartHitTestElementCommand(m_pPoint); CXTPChartPointF point = GetScreenPoint(); pCommand->AddChildCommand(((CXTPChartPointSeriesStyle*)GetSeriesView()->GetStyle())->GetMarker()->CreateDeviceCommand(pDC, point, color, color2, colorBorder)); return pCommand; }
CXTPChartPointF CXTPChartHighLowSeriesPointView::GetScreenPoint(int nIndex) { CXTPChartHighLowSeriesView* pView = (CXTPChartHighLowSeriesView*)GetSeriesView(); return pView->GetScreenPoint(m_pPoint->GetInternalArgumentValue(), m_pPoint->GetValue(nIndex)); }
CXTPChartDeviceCommand* CXTPChartSeriesPointView::CreateLegendDeviceCommand(CXTPChartDeviceContext* pDC, CRect rcBounds) { return GetSeriesView()->CreateLegendDeviceCommand(pDC, rcBounds); }
CXTPChartPointF CXTPChartPointSeriesPointView::GetScreenPoint() const { CXTPChartPointSeriesView* pView = (CXTPChartPointSeriesView*)GetSeriesView(); return pView->GetScreenPoint(m_pPoint->GetInternalArgumentValue(), m_dInternalValue); }