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; }
CXTPChartDeviceCommand* CXTPChartRadarAxisYView::CreateLabelsDeviceCommand(CXTPChartDeviceContext* pDC) { if (!m_pAxis->GetLabel()->IsVisible()) return NULL; CXTPChartDeviceCommand* pLabelsCommand = new CXTPChartHitTestElementCommand(m_pAxis->GetLabel(), m_rcBounds); CXTPChartColor clrAxis = m_pAxis->GetActualColor(); int nAngle = m_pAxis->GetLabel()->GetAngle(); BOOL bNear = m_pAxis->GetAlignment() == xtpChartAxisNear; int nOffset = m_pAxis->GetThickness() + (m_pAxis->GetTickMarks()->IsVisible() ? m_pAxis->GetTickMarks()->GetLength() : 0); for (int i = 0; i < m_arrTicks.GetSize(); i++) { int nLeft = m_ptCenter.Y - (int)ValueToRadius(m_arrTicks[i].m_dValue); CXTPChartString s = m_arrTicks[i].m_strLabel; CXTPChartRotatedTextPainterNearLine painter(pDC, s, m_pAxis->GetLabel(), CPoint(bNear ? m_rcBounds.right - nOffset : m_rcBounds.left + nOffset, nLeft), bNear ? xtpChartTextNearLeft : xtpChartTextNearRight, (float)nAngle); pLabelsCommand->AddChildCommand(painter.CreateDeviceCommand(pDC, m_pAxis->GetLabel()->GetActualTextColor())); } return pLabelsCommand; }
CXTPChartDeviceCommand* CXTPChartRadarAxisYView::CreateTitleDeviceCommand(CXTPChartDeviceContext* pDC) { CXTPChartAxisTitle* pTitle = GetAxis()->GetTitle(); if (!pTitle->IsVisible()) return NULL; CXTPChartString strText = pTitle->GetText(); CXTPChartDeviceCommand* pCommand = new CXTPChartHitTestElementCommand(pTitle, m_rcBounds); if (m_pAxis->GetAlignment() == xtpChartAxisNear) { CXTPChartRotatedTextPainterNearLine painter(pDC, pTitle->GetText(), pTitle, CPoint(m_rcBounds.left, m_rcBounds.CenterPoint().y), xtpChartTextNearRight, 270); pCommand->AddChildCommand(painter.CreateDeviceCommand(pDC, pTitle->GetActualTextColor())); } else { CXTPChartRotatedTextPainterNearLine painter(pDC, pTitle->GetText(), pTitle, CPoint(m_rcBounds.right, m_rcBounds.CenterPoint().y), xtpChartTextNearLeft, 90); pCommand->AddChildCommand(painter.CreateDeviceCommand(pDC, pTitle->GetActualTextColor())); } return pCommand; }
CXTPChartDeviceCommand* CXTPChartPyramidSeriesView::CreateLegendDeviceCommand(CXTPChartDeviceContext* pDC, CRect rcBounds, CXTPChartColor color1, CXTPChartColor color2, CXTPChartColor clrBorder) { UNREFERENCED_PARAMETER(pDC); rcBounds.DeflateRect(1, 1); CXTPChartPyramidSeriesStyle* pStyle = STATIC_DOWNCAST(CXTPChartPyramidSeriesStyle, GetStyle()); CXTPChartDeviceCommand* pCommand = new CXTPChartPolygonAntialiasingDeviceCommand(); CXTPChartPoints arrPoints; arrPoints.Add(CXTPChartPointF((rcBounds.left + rcBounds.right) / 2, rcBounds.top)); arrPoints.Add(CXTPChartPointF(rcBounds.right, rcBounds.bottom )); arrPoints.Add(CXTPChartPointF(rcBounds.left, rcBounds.bottom)); pCommand->AddChildCommand(pStyle->GetFillStyle()->CreateDeviceCommand(arrPoints, color1, color2)); if (pStyle->GetBorder()->IsVisible()) pCommand->AddChildCommand(new CXTPChartBoundedPolygonDeviceCommand(arrPoints, clrBorder, 1)); return pCommand; }
CXTPChartDeviceCommand* CXTPChartRadarAxisXView::CreateDeviceCommand(CXTPChartDeviceContext* pDC) { CXTPChartDeviceCommand* pAxisCommand = new CXTPChartPolygonAntialiasingDeviceCommand(TRUE); CXTPChartColor clrAxis = m_pAxis->GetActualColor(); int nThickness = m_pAxis->GetThickness(); if (m_pAxis->IsVisible()) { if (nThickness > 0) { if (IsPolygonDiagramStyle()) { CXTPChartLineStyle lineStyle(NULL); lineStyle.SetThickness(nThickness); pAxisCommand->AddChildCommand(GetDiagramView()->CreatePolygonLineDeviceCommand(pDC, m_nRadius, clrAxis, &lineStyle)); } else { pAxisCommand->AddChildCommand(new CXTPChartBoundedCircleDeviceCommand(m_ptCenter, m_nRadius, clrAxis, nThickness)); } } pAxisCommand->AddChildCommand(CreateTickMarksDeviceCommand(pDC)); pAxisCommand->AddChildCommand(CreateLabelsDeviceCommand(pDC)); } return pAxisCommand; }
CXTPChartDeviceCommand* CXTPChartRadarAxisYView::CreateConstantLinesDeviceCommand(CXTPChartDeviceContext* pDC, BOOL bBehind) { CXTPChartAxisConstantLines* pConstantLines = m_pAxis->GetConstantLines(); if (pConstantLines->GetCount() == 0) return NULL; CXTPChartDeviceCommand* pCommands = new CXTPChartDeviceCommand(); for (int i = 0; i < pConstantLines->GetCount(); i++) { CXTPChartAxisConstantLine* pConstantLine = pConstantLines->GetAt(i); if (!pConstantLine->IsVisible()) continue; if (pConstantLine->IsShowBehind() != bBehind) continue; double dMark = !pConstantLine->GetAxisValue().IsEmpty() ? m_pAxis->GetScaleTypeMap()->ValueToInternal(pConstantLine->GetAxisValue()) : pConstantLine->GetAxisValueInternal(); double dRad = ValueToRadius(dMark); if (IsPolygonDiagramStyle()) pCommands->AddChildCommand(GetDiagramView()->CreatePolygonLineDeviceCommand(pDC, dRad, pConstantLine->GetActualColor(), pConstantLine->GetLineStyle())); else pCommands->AddChildCommand(new CXTPChartBoundedCircleDeviceCommand(m_ptCenter, dRad, pConstantLine->GetActualColor(), pConstantLine->GetLineStyle()->GetThickness())); } return pCommands; }
CXTPChartDeviceCommand* CXTPChartPyramidSeriesView::CreateDeviceCommand(CXTPChartDeviceContext* pDC) { CXTPChartDeviceCommand* pCommand = new CXTPChartPolygonAntialiasingDeviceCommand(); pCommand->AddChildCommand(CXTPChartSeriesView::CreateDeviceCommand(pDC)); return pCommand; }
CXTPChartDeviceCommand* CXTPChartAreaSeriesView::CreateLegendDeviceCommand(CXTPChartDeviceContext* pDC, CRect rcBounds) { UNREFERENCED_PARAMETER(pDC); rcBounds.DeflateRect(1, 1); CXTPChartDeviceCommand* pCommand = new CXTPChartPolygonAntialiasingDeviceCommand(); CXTPChartAreaSeriesStyle* pStyle = STATIC_DOWNCAST(CXTPChartAreaSeriesStyle, m_pSeries->GetStyle()); CXTPChartPointF ptCenter(rcBounds.CenterPoint().x, rcBounds.top + 4) ; int nSize = 8; CXTPChartPoints arrPoints; arrPoints.Add(CXTPChartPointF(rcBounds.left, rcBounds.bottom + 1)); arrPoints.Add(CXTPChartPointF(ptCenter.X, float(rcBounds.top + 4))); arrPoints.Add(CXTPChartPointF(rcBounds.right, rcBounds.bottom + 1)); pCommand->AddChildCommand(pStyle->GetFillStyle()->CreateDeviceCommand(arrPoints, GetActualColor(), GetActualColor2())); CXTPChartColor clrBorder = GetBorderActualColor(); pCommand->AddChildCommand(new CXTPChartSolidLineDeviceCommand(arrPoints[0], arrPoints[1], clrBorder, 1)); pCommand->AddChildCommand(new CXTPChartSolidLineDeviceCommand(arrPoints[1], arrPoints[2], clrBorder, 1)); pCommand->AddChildCommand(pStyle->GetMarker()->CreateDeviceCommand(pDC, ptCenter, nSize, GetColor(), GetColor2(), GetColor().GetDarkColor())); return pCommand; }
CXTPChartDeviceCommand* CXTPChartDiagramView::CreateDeviceCommand(CXTPChartDeviceContext* pDC) { CXTPChartDeviceCommand* pCommand = new CXTPChartHitTestElementCommand(m_pDiagram, m_rcBounds); pCommand->AddChildCommand(CXTPChartElementView::CreateDeviceCommand(pDC)); return pCommand; }
CXTPChartDeviceCommand* CXTPChartRadarAxisYView::CreateTickMarksDeviceCommand(CXTPChartDeviceContext* pDC) { UNREFERENCED_PARAMETER(pDC); CXTPChartDeviceCommand* pCommands = new CXTPChartHitTestElementCommand(m_pAxis, m_rcBounds); CXTPChartAxisTickMarks* pTickMarks = m_pAxis->GetTickMarks(); if (!pTickMarks->IsVisible()) return pCommands; int nScrollBarSize = 0; CXTPChartColor clrAxis = m_pAxis->GetActualColor(); int nLength = pTickMarks->GetLength(); int nThickness = pTickMarks->GetThickness(); BOOL bMinorVisible = pTickMarks->IsMinorVisible(); BOOL bCross = pTickMarks->IsCrossAxis(); int nAxisThickness = m_pAxis->GetThickness() - 1 + nScrollBarSize; int nExtraLength = bCross ? nLength + nAxisThickness : 0; for (int i = 0; i < m_arrTicks.GetSize(); i++) { int nLeft = m_ptCenter.Y - (int)ValueToRadius(m_arrTicks[i].m_dValue); if (m_pAxis->GetAlignment() == xtpChartAxisNear) pCommands->AddChildCommand(new CXTPChartSolidLineDeviceCommand(CXTPPoint3d(m_rcBounds.right - nAxisThickness - nLength, nLeft), CXTPPoint3d(m_rcBounds.right - nAxisThickness + nExtraLength, nLeft), clrAxis, nThickness)); else pCommands->AddChildCommand(new CXTPChartSolidLineDeviceCommand(CXTPPoint3d(m_rcBounds.left + nAxisThickness - nExtraLength, nLeft), CXTPPoint3d(m_rcBounds.left + nAxisThickness + nLength, nLeft), clrAxis, nThickness)); } if (bMinorVisible) { nLength = pTickMarks->GetMinorLength(); int nExtraLength = bCross ? nLength + nAxisThickness : 0; int nMinorThickness = pTickMarks->GetMinorThickness(); for (int i = 0; i < m_arrMinorTicks.GetSize(); i++) { int nLeft = m_ptCenter.Y - (int)ValueToRadius(m_arrMinorTicks[i]); if (m_pAxis->GetAlignment() == xtpChartAxisNear) pCommands->AddChildCommand(new CXTPChartSolidLineDeviceCommand(CXTPPoint3d(m_rcBounds.right - nAxisThickness - nLength, nLeft), CXTPPoint3d(m_rcBounds.right - nAxisThickness + nExtraLength, nLeft), clrAxis, nMinorThickness)); else pCommands->AddChildCommand(new CXTPChartSolidLineDeviceCommand(CXTPPoint3d(m_rcBounds.left + nAxisThickness - nExtraLength, nLeft), CXTPPoint3d(m_rcBounds.left + nAxisThickness + nLength, nLeft), clrAxis, nMinorThickness)); } } return pCommands; }
CXTPChartDeviceCommand* CXTPChartRadarAxisXView::CreateTickMarksDeviceCommand(CXTPChartDeviceContext* pDC) { UNREFERENCED_PARAMETER(pDC); CXTPChartDeviceCommand* pCommands = new CXTPChartHitTestElementCommand(m_pAxis, m_rcBounds); CXTPChartAxisTickMarks* pTickMarks = m_pAxis->GetTickMarks(); if (!pTickMarks->IsVisible()) return pCommands; CXTPChartColor clrAxis = m_pAxis->GetActualColor(); int nLength = pTickMarks->GetLength(); int nThickness = pTickMarks->GetThickness(); BOOL bMinorVisible = pTickMarks->IsMinorVisible(); BOOL bCross = pTickMarks->IsCrossAxis(); int nAxisThickness = m_pAxis->GetThickness() - 1; int nExtraLength = bCross ? nLength + nAxisThickness : 0; for (int i = 0; i < m_arrTicks.GetSize(); i++) { double lineAngle = ValueToAngle(m_arrTicks[i].m_dValue); double cs = cos(lineAngle); double sn = sin(lineAngle); CXTPChartPointF startPoint(m_ptCenter.X + (m_nRadius - nExtraLength) * cs, m_ptCenter.Y - (m_nRadius - nExtraLength) * sn); CXTPChartPointF finishPoint(m_ptCenter.X + (m_nRadius + nAxisThickness + nLength) * cs, m_ptCenter.Y - (m_nRadius + nAxisThickness + nLength) * sn); pCommands->AddChildCommand(new CXTPChartSolidLineDeviceCommand(startPoint, finishPoint, clrAxis, nThickness)); } if (bMinorVisible && !IsPolygonDiagramStyle()) { nLength = pTickMarks->GetMinorLength(); int nExtraLength = bCross ? nLength + nAxisThickness : 0; int nMinorThickness = pTickMarks->GetMinorThickness(); for (int i = 0; i < m_arrMinorTicks.GetSize(); i++) { double lineAngle = ValueToAngle(m_arrMinorTicks[i]); double cs = cos(lineAngle); double sn = sin(lineAngle); CXTPChartPointF startPoint(m_ptCenter.X + (m_nRadius - nExtraLength) * cs, m_ptCenter.Y - (m_nRadius - nExtraLength) * sn); CXTPChartPointF finishPoint(m_ptCenter.X + (m_nRadius + nAxisThickness + nLength) * cs, m_ptCenter.Y - (m_nRadius + nAxisThickness + nLength) * sn); pCommands->AddChildCommand(new CXTPChartSolidLineDeviceCommand(startPoint, finishPoint, clrAxis, nMinorThickness)); } } return pCommands; }
CXTPChartDeviceCommand* CXTPChartTitleView::CreateDeviceCommand(CXTPChartDeviceContext* pDC) { CXTPChartDeviceCommand* pCommand = new CXTPChartHitTestElementCommand(m_pTitle); CXTPChartRotatedTextPainterNearLine painter(pDC, m_strText, m_pTitle, m_ptOrigin, m_pTitle->GetNearTextPosition(), (float)m_pTitle->GetTextAngle()); CXTPChartDeviceCommand* pTextCommand = painter.CreateDeviceCommand(pDC, m_pTitle->GetActualTextColor()); pCommand->AddChildCommand(pTextCommand); return pCommand; }
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* CXTPChartContentView::CreateDeviceCommand(CXTPChartDeviceContext* pDC) { CXTPChartDeviceCommand* pCommand = new CXTPChartHitTestElementCommand(m_pContent, m_rcBounds); pCommand->AddChildCommand(new CXTPChartSolidRectangleDeviceCommand(m_rcBounds, m_pContent->GetActualBackgroundColor())); CXTPChartDeviceCommand* pDrawingType = pCommand->AddChildCommand(new CXTPChartDeviceCommand()); if (m_pContent->GetBorder()->IsVisible()) { pDrawingType->AddChildCommand(m_pContent->GetBorder()->CreateInnerBorderDeviceCommand(m_rcBounds, m_pContent->GetActualBorderColor())); } if (m_pDiagramView) { pDrawingType->AddChildCommand(m_pDiagramView->CreateDeviceCommand(pDC)); } if (m_pLegendView) { pDrawingType->AddChildCommand(m_pLegendView->CreateDeviceCommand(pDC)); } if (m_pTitlesView) { pDrawingType->AddChildCommand(m_pTitlesView->CreateDeviceCommand(pDC)); } return pCommand; }
CXTPChartDeviceCommand* CXTPChartPointSeriesView::CreateLegendDeviceCommand(CXTPChartDeviceContext* pDC, CRect rcBounds) { UNREFERENCED_PARAMETER(pDC); rcBounds.DeflateRect(1, 1, 2, 2); CXTPChartDeviceCommand* pCommand = new CXTPChartDeviceCommand(); CXTPChartPointSeriesStyle* pStyle = STATIC_DOWNCAST(CXTPChartPointSeriesStyle, m_pSeries->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* CXTPChartRadarAxisXView::CreateInterlacedDeviceCommand(CXTPChartDeviceContext* pDC) { UNREFERENCED_PARAMETER(pDC); if (!m_pAxis->IsInterlaced()) return NULL; if (m_arrTicks.GetSize() < 2) return NULL; CXTPChartDeviceCommand* pCommands = new CXTPChartDeviceCommand(); CXTPChartColor color1 = m_pAxis->GetActualInterlacedColor(); CXTPChartColor color2 = m_pAxis->GetActualInterlacedColor2(); for (int i = 0; i + 1 < m_arrTicks.GetSize(); i += 2) { double dFrom = ValueToAngle(m_arrTicks[i].m_dValue); double dTo = ValueToAngle(m_arrTicks[i + 1].m_dValue); if (dTo > dFrom) dTo -= 2 * CXTPChartMathUtils::m_dPI; if (IsPolygonDiagramStyle()) { CXTPChartPoints pts; pts.Add(m_ptCenter); pts.Add(CXTPChartPointF(m_ptCenter.X + cos(dFrom) * m_nRadius, m_ptCenter.Y - sin(dFrom) * m_nRadius)); pts.Add(CXTPChartPointF(m_ptCenter.X + cos(dTo) * m_nRadius, m_ptCenter.Y - sin(dTo) * m_nRadius)); pCommands->AddChildCommand(m_pAxis->GetInterlacedFillStyle()->CreateDeviceCommand(pts, color1, color2)); } else { pCommands->AddChildCommand(new CXTPChartGradientPieDeviceCommand(CXTPPoint3d(m_ptCenter), m_nRadius, m_nRadius, -CXTPChartMathUtils::Radian2Degree(dFrom), CXTPChartMathUtils::Radian2Degree(dFrom - dTo), 0, 0, m_rcBounds, color1, color2)); } } return pCommands; }
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; }
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; }
CXTPChartDeviceCommand* CXTPChartRadarAxisYView::CreateGridLinesDeviceCommand(CXTPChartDeviceContext* pDC) { UNREFERENCED_PARAMETER(pDC); CXTPChartAxisGridLines* pGridLines = m_pAxis->GetGridLines(); if (!pGridLines->IsVisible()) return NULL; CXTPChartDeviceCommand* pCommands = new CXTPChartDeviceCommand(); CXTPChartColor clrGridLines = pGridLines->GetColor(); CXTPChartColor clrMinorGridLines = pGridLines->GetMinorColor(); BOOL bMinorVisible = pGridLines->IsMinorVisible(); for (int i = 0; i < m_arrTicks.GetSize(); i++) { double dRadius = ValueToRadius(m_arrTicks[i].m_dValue); if (IsPolygonDiagramStyle()) pCommands->AddChildCommand(GetDiagramView()->CreatePolygonLineDeviceCommand(pDC, dRadius, clrGridLines, pGridLines->GetLineStyle())); else pCommands->AddChildCommand(new CXTPChartBoundedCircleDeviceCommand(m_ptCenter, dRadius, clrGridLines, pGridLines->GetLineStyle()->GetThickness())); } if (bMinorVisible) { for (int i = 0; i < m_arrMinorTicks.GetSize(); i++) { double dRadius = ValueToRadius(m_arrMinorTicks[i]); if (IsPolygonDiagramStyle()) pCommands->AddChildCommand(GetDiagramView()->CreatePolygonLineDeviceCommand(pDC, dRadius, clrMinorGridLines, pGridLines->GetMinorLineStyle())); else pCommands->AddChildCommand(new CXTPChartBoundedCircleDeviceCommand(m_ptCenter, dRadius, clrMinorGridLines, pGridLines->GetMinorLineStyle()->GetThickness())); } } return pCommands; }
CXTPChartDeviceCommand* CXTPChartRadarAxisYView::CreateInterlacedDeviceCommand(CXTPChartDeviceContext* pDC) { UNREFERENCED_PARAMETER(pDC); if (!m_pAxis->IsInterlaced()) return NULL; if (m_arrTicks.GetSize() < 1) return NULL; CXTPChartDeviceCommand* pCommands = new CXTPChartDeviceCommand(); CXTPChartColor color1 = m_pAxis->GetActualInterlacedColor(); CXTPChartColor color2 = m_pAxis->GetActualInterlacedColor2(); for (int i = 0; i < m_arrTicks.GetSize(); i += 2) { double dRFrom = ValueToRadius(m_arrTicks[i].m_dValue); double dRTo = i + 1 == m_arrTicks.GetSize() ? m_nRadius : ValueToRadius(m_arrTicks[i + 1].m_dValue); if (IsPolygonDiagramStyle()) { CXTPChartRadarDiagramView* pDiagramView = GetDiagramView(); pCommands->AddChildCommand(pDiagramView->CreatePolygonStripDeviceCommand(pDC, dRFrom, dRTo, color1, color2, m_pAxis->GetInterlacedFillStyle())); } else { pCommands->AddChildCommand(new CXTPChartGradientPieDeviceCommand(CXTPPoint3d(m_ptCenter), dRTo, dRTo, 0, 360, 0, dRFrom / dRTo * 100, m_rcPaneBounds, color1, color2)); } } return pCommands; }
CXTPChartDeviceCommand* CXTPChartRadarAxisYView::CreateStripsDeviceCommand(CXTPChartDeviceContext* pDC) { UNREFERENCED_PARAMETER(pDC); CXTPChartAxisStrips* pStrips = m_pAxis->GetStrips(); if (pStrips->GetCount() == 0) return NULL; CXTPChartDeviceCommand* pCommands = new CXTPChartDeviceCommand(); for (int i = 0; i < pStrips->GetCount(); i++) { CXTPChartAxisStrip* pStrip = pStrips->GetAt(i); if (!pStrip->IsVisible()) continue; double dMarkLeft = !pStrip->GetAxisMinValue().IsEmpty() ? m_pAxis->GetScaleTypeMap()->ValueToInternal(pStrip->GetAxisMinValue()) : pStrip->GetAxisMinValueInternal(); double dMarkRight = !pStrip->GetAxisMaxValue().IsEmpty() ? m_pAxis->GetScaleTypeMap()->ValueToInternal(pStrip->GetAxisMaxValue()) : pStrip->GetAxisMaxValueInternal(); double dRFrom = ValueToRadius(dMarkLeft); double dRTo = ValueToRadius(dMarkRight); if (IsPolygonDiagramStyle()) { pCommands->AddChildCommand(GetDiagramView()->CreatePolygonStripDeviceCommand(pDC, dRFrom, dRTo, pStrip->GetActualColor(), pStrip->GetActualColor2(), pStrip->GetFillStyle())); } else { pCommands->AddChildCommand(new CXTPChartGradientPieDeviceCommand(CXTPPoint3d(m_ptCenter), dRTo, dRTo, 0, 360, 0, dRFrom / dRTo * 100, m_rcPaneBounds, pStrip->GetActualColor(), pStrip->GetActualColor2())); } } return pCommands; }
CXTPChartDeviceCommand* CXTPChartRadarAxisXView::CreateStripsDeviceCommand(CXTPChartDeviceContext* pDC) { UNREFERENCED_PARAMETER(pDC); CXTPChartAxisStrips* pStrips = m_pAxis->GetStrips(); if (pStrips->GetCount() == 0) return NULL; if (IsPolygonDiagramStyle()) // TODO return NULL; CXTPChartDeviceCommand* pCommands = new CXTPChartDeviceCommand(); for (int i = 0; i < pStrips->GetCount(); i++) { CXTPChartAxisStrip* pStrip = pStrips->GetAt(i); if (!pStrip->IsVisible()) continue; double dMarkLeft = !pStrip->GetAxisMinValue().IsEmpty() ? m_pAxis->GetScaleTypeMap()->ValueToInternal(pStrip->GetAxisMinValue()) : pStrip->GetAxisMinValueInternal(); double dMarkRight = !pStrip->GetAxisMaxValue().IsEmpty() ? m_pAxis->GetScaleTypeMap()->ValueToInternal(pStrip->GetAxisMaxValue()) : pStrip->GetAxisMaxValueInternal(); double dFrom = ValueToAngle(dMarkLeft); double dTo = ValueToAngle(dMarkRight); if (dTo > dFrom) dTo -= 2 * CXTPChartMathUtils::m_dPI; pCommands->AddChildCommand(new CXTPChartGradientPieDeviceCommand(CXTPPoint3d(m_ptCenter), m_nRadius, m_nRadius, -CXTPChartMathUtils::Radian2Degree(dFrom), -CXTPChartMathUtils::Radian2Degree(dTo - dFrom), 0, 0, m_rcBounds, pStrip->GetActualColor(), pStrip->GetActualColor2())); } return pCommands; }
CXTPChartDeviceCommand* CXTPChartRadarAxisXView::CreateLabelsDeviceCommand(CXTPChartDeviceContext* pDC) { if (!m_pAxis->GetLabel()->IsVisible()) return NULL; CXTPChartDeviceCommand* pLabelsCommand = new CXTPChartHitTestElementCommand(m_pAxis->GetLabel(), m_rcBounds); CXTPChartColor clrAxis = m_pAxis->GetActualColor(); CXTPChartColor clrTextColor = m_pAxis->GetLabel()->GetActualTextColor(); for (int i = 0; i < m_arrTicks.GetSize(); i++) { CXTPChartString text = m_arrTicks[i].m_strLabel; CXTPChartTextPainter painter(pDC, text, m_pAxis->GetLabel()); painter.SetLocation(m_arrTicks[i].m_ptLocation); pLabelsCommand->AddChildCommand(painter.CreateDeviceCommand(pDC, clrTextColor)); } return pLabelsCommand; }
CXTPChartDeviceCommand* CXTPChartRadarAxisXView::CreateConstantLinesDeviceCommand(CXTPChartDeviceContext* pDC, BOOL bBehind) { CXTPChartAxisConstantLines* pConstantLines = m_pAxis->GetConstantLines(); if (pConstantLines->GetCount() == 0) return NULL; CXTPChartDeviceCommand* pCommands = new CXTPChartDeviceCommand(); for (int i = 0; i < pConstantLines->GetCount(); i++) { CXTPChartAxisConstantLine* pConstantLine = pConstantLines->GetAt(i); if (!pConstantLine->IsVisible()) continue; if (pConstantLine->IsShowBehind() != bBehind) continue; double dMark = !pConstantLine->GetAxisValue().IsEmpty() ? m_pAxis->GetScaleTypeMap()->ValueToInternal(pConstantLine->GetAxisValue()) : pConstantLine->GetAxisValueInternal(); double lineAngle = ValueToAngle(dMark); CXTPPoint3d ptEnd(m_ptCenter.X + cos(lineAngle) * m_nRadius, m_ptCenter.Y - sin(lineAngle) * m_nRadius); pCommands->AddChildCommand(pConstantLine->GetLineStyle()->CreateDeviceCommand(CXTPPoint3d(m_ptCenter), ptEnd, pConstantLine->GetActualColor())); CXTPChartString strText = pConstantLine->GetText(); CPoint ptText(int(m_ptCenter.X + cos(lineAngle) * (m_nRadius - 5)), int(m_ptCenter.Y - sin(lineAngle) * (m_nRadius - 5))); CXTPChartRotatedTextPainterNearLine painter(pDC, strText, pConstantLine, ptText, xtpChartTextNearTop, -(float)CXTPChartMathUtils::Radian2Degree(lineAngle)); pCommands->AddChildCommand(painter.CreateDeviceCommand(pDC, pConstantLine->GetActualTextColor())); } return pCommands; }
CXTPChartDeviceCommand* CXTPChartHighLowSeriesView::CreateLegendDeviceCommand(CXTPChartDeviceContext* pDC, CRect rcBounds) { UNREFERENCED_PARAMETER(pDC); rcBounds.DeflateRect(1, 1); CXTPChartDeviceCommand* pCommand = new CXTPChartDeviceCommand(); CXTPChartHighLowSeriesStyle* pStyle = STATIC_DOWNCAST(CXTPChartHighLowSeriesStyle, m_pSeries->GetStyle()); CPoint ptCenter(rcBounds.CenterPoint().x, rcBounds.CenterPoint().y) ; for (int i = 0; i < 2; i++) { CXTPChartColor color = i == 0 ? pStyle->GetUpColor() : pStyle->GetDownColor(); int nHeight = rcBounds.Height() - 3; int x = i == 0 ? ptCenter.x - 4 : ptCenter.x + 4; int y = i == 0 ? rcBounds.top : rcBounds.top + 3; CPoint pointHight(x, y); CPoint pointLow(x, pointHight.y + nHeight); CPoint pointOpen(x, pointHight.y + nHeight / 3); CPoint pointClose(x, pointHight.y + nHeight * 2 / 3); int nWidth = 6; pCommand->AddChildCommand(new CXTPChartSolidLineDeviceCommand( CXTPChartPointF(pointHight), CXTPChartPointF(pointLow), color, 2)); pCommand->AddChildCommand(new CXTPChartSolidLineDeviceCommand( CXTPChartPointF(pointOpen), CXTPChartPointF((float)(pointOpen.x - nWidth / 2), (float)pointOpen.y), color, 2)); pCommand->AddChildCommand(new CXTPChartSolidLineDeviceCommand( CXTPChartPointF(pointClose), CXTPChartPointF((float)(pointClose.x + nWidth / 2), (float)pointClose.y), color, 2)); } return pCommand; }
CXTPChartDeviceCommand* CXTPChartRangeBarSeriesLabelView::CreateDeviceCommand(CXTPChartDeviceContext* pDC) { CXTPChartRangeBarSeriesLabel* pLabel = (CXTPChartRangeBarSeriesLabel*)m_pLabel; if (pLabel->GetType() == xtpChartRangeBarOneLabel) { CString strText = m_pLabel->GetPointLabel(m_pPointView->GetPoint(), 0) + _T(", ") + m_pLabel->GetPointLabel(m_pPointView->GetPoint(), 1); return CXTPChartDiagram2DSeriesLabelView::CreateDeviceCommand(pDC, GetAnchorPoint(0), strText); } if (pLabel->GetType() == xtpChartRangeBarTwoLabels) { CXTPChartDeviceCommand* pCommand = new CXTPChartDeviceCommand(); CString strText = m_pLabel->GetPointLabel(m_pPointView->GetPoint(), 0); pCommand->AddChildCommand(CXTPChartDiagram2DSeriesLabelView::CreateDeviceCommand(pDC, GetAnchorPoint(TRUE), GetAnchorAngle(TRUE), strText)); strText = m_pLabel->GetPointLabel(m_pPointView->GetPoint(), 1); pCommand->AddChildCommand(CXTPChartDiagram2DSeriesLabelView::CreateDeviceCommand(pDC, GetAnchorPoint(FALSE), GetAnchorAngle(FALSE), strText)); return pCommand; } if (pLabel->GetType() == xtpChartRangeBarMinValueLabel) { CString strText = m_pLabel->GetPointLabel(m_pPointView->GetPoint(), 0); return CXTPChartDiagram2DSeriesLabelView::CreateDeviceCommand(pDC, GetAnchorPoint(TRUE), GetAnchorAngle(TRUE), strText); } if (pLabel->GetType() == xtpChartRangeBarMaxValueLabel) { CString strText = m_pLabel->GetPointLabel(m_pPointView->GetPoint(), 1); return CXTPChartDiagram2DSeriesLabelView::CreateDeviceCommand(pDC, GetAnchorPoint(FALSE), GetAnchorAngle(FALSE), strText); } return 0; }
CXTPChartDeviceCommand* CXTPChartRadarAxisYView::CreateDeviceCommand(CXTPChartDeviceContext* pDC) { CXTPChartDeviceCommand* pAxisCommand = new CXTPChartDeviceCommand(); CXTPChartColor clrAxis = m_pAxis->GetActualColor(); int nScrollBarSize = 0; int nThickness = m_pAxis->GetThickness(); if (m_pAxis->IsVisible()) { float fPosition = m_pAxis->GetAlignment() == xtpChartAxisNear ? m_rcBounds.right - nScrollBarSize - nThickness / 2.0f + 0.5f : m_rcBounds.left + nScrollBarSize + nThickness / 2.0f - 0.5f; pAxisCommand->AddChildCommand(new CXTPChartSolidLineDeviceCommand(CXTPPoint3d(fPosition, (float)m_rcBounds.top), CXTPPoint3d(fPosition, m_rcBounds.bottom + 0.5f), clrAxis, m_pAxis->GetThickness())); pAxisCommand->AddChildCommand(CreateTickMarksDeviceCommand(pDC)); pAxisCommand->AddChildCommand(CreateLabelsDeviceCommand(pDC)); pAxisCommand->AddChildCommand(CreateTitleDeviceCommand(pDC)); } return pAxisCommand; }
CXTPChartDeviceCommand* CXTPChartRadarAxisXView::CreateGridLinesDeviceCommand(CXTPChartDeviceContext* pDC) { UNREFERENCED_PARAMETER(pDC); CXTPChartAxisGridLines* pGridLines = m_pAxis->GetGridLines(); if (!pGridLines->IsVisible()) return NULL; CXTPChartDeviceCommand* pCommands = new CXTPChartDeviceCommand(); CXTPChartColor clrGridLines = pGridLines->GetColor(); CXTPChartColor clrMinorGridLines = pGridLines->GetMinorColor(); BOOL bMinorVisible = pGridLines->IsMinorVisible(); for (int i = 0; i < m_arrTicks.GetSize(); i++) { double lineAngle = ValueToAngle(m_arrTicks[i].m_dValue); pCommands->AddChildCommand(pGridLines->GetLineStyle()->CreateDeviceCommand(CXTPPoint3d(m_ptCenter.X, m_ptCenter.Y), CXTPPoint3d(m_ptCenter.X + cos(lineAngle) * m_nRadius, m_ptCenter.Y - sin(lineAngle) * m_nRadius), clrGridLines)); } if (bMinorVisible && !IsPolygonDiagramStyle()) { for (int i = 0; i < m_arrMinorTicks.GetSize(); i++) { double lineAngle = ValueToAngle(m_arrMinorTicks[i]); pCommands->AddChildCommand(pGridLines->GetMinorLineStyle()->CreateDeviceCommand(CXTPPoint3d(m_ptCenter.X, m_ptCenter.Y), CXTPPoint3d(m_ptCenter.X + cos(lineAngle) * m_nRadius, m_ptCenter.Y - sin(lineAngle) * m_nRadius), clrMinorGridLines)); } } return pCommands; }
CXTPChartDeviceCommand* CXTPChartAreaSeriesView::CreateDeviceCommand(CXTPChartDeviceContext* pDC) { CXTPChartDeviceCommand* pSeriesCommand = new CXTPChartHitTestElementCommand(m_pSeries); CXTPChartDeviceCommand* pCommand = pSeriesCommand->AddChildCommand(new CXTPChartPolygonAntialiasingDeviceCommand()); CXTPChartAreaSeriesStyle* pStyle = (CXTPChartAreaSeriesStyle*)GetStyle(); CXTPChartAxis* pAxisY = GetAxisViewY()->GetAxis(); CXTPChartColor clrBorder = GetBorderActualColor(); double dZero = max(0, pAxisY->GetRange()->GetMinValue()); int nCount = m_pPointsView->GetCount(); if (nCount > 1) { CXTPChartPointSeriesPointView* pPointView = (CXTPChartPointSeriesPointView*)m_pPointsView->GetAt(0); CXTPChartPointF pointPrev = GetScreenPoint(pPointView->GetPoint()->GetInternalArgumentValue(), pPointView->m_dInternalValue); CXTPChartPoints arrPoints; arrPoints.Add(GetScreenPoint(pPointView->GetPoint()->GetInternalArgumentValue(), dZero)); for (int i = 1; i < nCount; i++) { pPointView = (CXTPChartPointSeriesPointView*)m_pPointsView->GetAt(i); CXTPChartPointF pointNext = pPointView->GetScreenPoint(); arrPoints.Add(pointPrev); pointPrev = pointNext; } arrPoints.Add(pointPrev); pPointView = (CXTPChartPointSeriesPointView*)m_pPointsView->GetAt(nCount - 1); arrPoints.Add(GetScreenPoint(pPointView->GetPoint()->GetInternalArgumentValue(), dZero)); pCommand->AddChildCommand(pStyle->GetFillStyle()->CreateDeviceCommand(arrPoints, GetActualColor(), GetActualColor2())); arrPoints.RemoveAt(0); arrPoints.RemoveAt(arrPoints.GetSize() - 1); if (pStyle->GetBorder()->IsVisible()) pCommand->AddChildCommand(new CXTPChartSolidPolylineDeviceCommand(arrPoints, clrBorder, pStyle->GetBorder()->GetThickness())); } pCommand->AddChildCommand(CXTPChartSeriesView::CreateDeviceCommand(pDC)); return pSeriesCommand; }
CXTPChartDeviceCommand* CXTPChartRadarSplineAreaSeriesView::CreateDeviceCommand(CXTPChartDeviceContext* pDC) { CXTPChartDeviceCommand* pSeriesCommand = new CXTPChartHitTestElementCommand(m_pSeries); CXTPChartDeviceCommand* pCommand = pSeriesCommand->AddChildCommand(new CXTPChartPolygonAntialiasingDeviceCommand()); CXTPChartRadarSplineAreaSeriesStyle* pStyle = (CXTPChartRadarSplineAreaSeriesStyle*)GetStyle(); int nCount = m_pPointsView->GetCount(); if (nCount > 1) { CXTPChartPoints arrPoints; for (int i = 0; i < nCount; i++) { CXTPChartRadarPointSeriesPointView* pPointView = (CXTPChartRadarPointSeriesPointView*)m_pPointsView->GetAt(i); CXTPChartPointF pointNext = pPointView->GetScreenPoint(); arrPoints.Add(pointNext); } CXTPChartPointF ptFirst = arrPoints[0]; arrPoints.Add(ptFirst); pCommand->AddChildCommand(pStyle->GetFillStyle()->CreateSplineDeviceCommand(arrPoints, GetActualColor(), GetActualColor2(), 2)); if (pStyle->GetBorder()->IsVisible()) { CXTPChartColor clrBorder = GetBorderActualColor(); pCommand->AddChildCommand(new CXTPChartSolidSplineDeviceCommand(arrPoints, clrBorder, pStyle->GetBorder()->GetThickness())); } } pCommand->AddChildCommand(CXTPChartSeriesView::CreateDeviceCommand(pDC)); return pSeriesCommand; }