本文整理汇总了C++中CChartAxis::SetAutoHideScrollBar方法的典型用法代码示例。如果您正苦于以下问题:C++ CChartAxis::SetAutoHideScrollBar方法的具体用法?C++ CChartAxis::SetAutoHideScrollBar怎么用?C++ CChartAxis::SetAutoHideScrollBar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChartAxis
的用法示例。
在下文中一共展示了CChartAxis::SetAutoHideScrollBar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void CNormalsChartsCtrl::Update()
{
string ID;
if (m_pStation)
{
ID = m_pStation->m_ID;
}
CWVariables variables = m_pStation->GetVariables();
CGraphVector chartsDefine = GetCharts(variables);
if (ID != m_lastStationID ||
chartsDefine != m_lastChartsDefine ||
m_zoom != m_lastZoom)
{
m_lastStationID = ID;
m_charts.clear();
m_splitters.clear();
m_scrollHelper->ScrollToOrigin(true, true);
if (m_pStation != NULL && !ID.empty())
{
CWaitCursor waitCursor;
CRegistry registry("Charts");
//pre-compute total graphics height
int totalHeight = 0;
for (CGraphVector::iterator it1 = chartsDefine.begin(); it1 != chartsDefine.end(); it1++)
totalHeight += max(50, min(800, registry.GetValue<int>("height" + to_string(it1->m_series.front().m_variable), 150)));
CRect rect;
GetClientRectSB(this, rect);
if (totalHeight > rect.Height())//if they have a scrollbar, remove width of crolbar
rect.right -= ::GetSystemMetrics(SM_CXVSCROLL);
int width = int(rect.Width()*m_zoom);// -10;
int height = 0;
int top = 0;
for (CGraphVector::iterator it1 = chartsDefine.begin(); it1 != chartsDefine.end(); it1++)
{
int firstVar = it1->m_series.front().m_variable;
int height = max(50, min(800, registry.GetValue<int>("height" + to_string(firstVar), 150)));
CChartCtrlPtr pChart;
pChart.reset(new CChartCtrl);
pChart->Create(this, CRect(0, top, width, top + height), CHART_BASE_ID + firstVar, WS_CHILD | WS_VISIBLE);
top += height;
pChart->EnableRefresh(false);
TChartString title = UtilWin::ToUTF16(it1->m_title);
pChart->GetTitle()->SetVisible(title.empty());
if (!title.empty())
pChart->GetTitle()->AddString(title);
pChart->GetLegend()->SetVisible(it1->m_bShowLegend);
pChart->GetLegend()->DockLegend(CChartLegend::dsDockBottomLeft);
pChart->GetLegend()->EnableShadow(false);
pChart->GetLegend()->EnableBorder(false);
pChart->GetLegend()->SetTransparent(true);
pChart->SetPanEnabled(false);
pChart->SetZoomEnabled(false);
pChart->SetBackGradient(RGB(250, 250, 250), RGB(200, 200, 200), gtVertical);
pChart->SetLineInfoEnabled(true);
//****************
//X
CTPeriod period(CTRef(YEAR_NOT_INIT, JANUARY, 0, 0, CTM(CTM::MONTHLY, CTM::OVERALL_YEARS)), CTRef(YEAR_NOT_INIT, DECEMBER, 0, 0, CTM(CTM::MONTHLY, CTM::OVERALL_YEARS)));
CChartTRefAxis* pAxisX = (CChartTRefAxis*)pChart->GetAxis(CChartCtrl::BottomAxis);
if (pAxisX == NULL)
{
pAxisX = new CChartTRefAxis;
pAxisX->SetMinMax(period.Begin(), period.End());
pAxisX->SetReferenceTick(period.Begin());
pAxisX->SetPanZoomEnabled(false);
pAxisX->EnableScrollBar(false);
pAxisX->SetAutoHideScrollBar(false);
pAxisX->GetGrid()->SetBackColor(gtAlternate2, RGB(235, 235, 255), RGB(245, 245, 255));
pChart->AttachCustomAxis(pAxisX, CChartCtrl::BottomAxis);
TChartString lable = UtilWin::ToUTF16(it1->m_Xtitle);
if (!lable.empty())
pAxisX->GetLabel()->SetText(lable);
}
ENSURE(pAxisX);
for (CGraphSerieVector::iterator it2 = it1->m_series.begin(); it2 != it1->m_series.end(); it2++)
{
//****************
//Y
CChartCtrl::EAxisPos axis = it2->m_YAxis == 0 ? CChartCtrl::LeftAxis : CChartCtrl::RightAxis;
//.........这里部分代码省略.........
示例2: Update
//.........这里部分代码省略.........
pChart->Create(this, CRect(0, top, width, top + height), CHART_BASE_ID + firstVar, WS_CHILD | WS_VISIBLE);
top += height;
pChart->EnableRefresh(false);
TChartString title = ToUTF16(it1->m_title);
pChart->GetTitle()->SetVisible(title.empty());
if (!title.empty())
pChart->GetTitle()->AddString(title);
pChart->GetLegend()->SetVisible(it1->m_bShowLegend);
pChart->GetLegend()->DockLegend(CChartLegend::dsDockBottomLeft);
pChart->GetLegend()->EnableShadow(false);
pChart->GetLegend()->EnableBorder(false);
pChart->GetLegend()->SetTransparent(true);
pChart->SetPanEnabled(false);
pChart->SetZoomEnabled(false);
pChart->SetBackGradient(RGB(250, 250, 250), RGB(200, 200, 200), gtVertical);
pChart->SetLineInfoEnabled(true);
//****************
//X
CChartTRefAxis* pAxisX = (CChartTRefAxis*)pChart->GetAxis(CChartCtrl::BottomAxis);
if (pAxisX == NULL)
{
pAxisX = new CChartTRefAxis;
pAxisX->SetMinMax(period.Begin().GetRef(), period.End().GetRef());
pAxisX->SetReferenceTick(period.Begin());
pAxisX->SetPanZoomEnabled(false);
pAxisX->EnableScrollBar(false);
pAxisX->SetAutoHideScrollBar(false);
pAxisX->GetGrid()->SetBackColor(gtAlternate2, RGB(235, 235, 255), RGB(245, 245, 255));
pChart->AttachCustomAxis(pAxisX, CChartCtrl::BottomAxis);
TChartString lable = ToUTF16(it1->m_Xtitle);
if (!lable.empty())
pAxisX->GetLabel()->SetText(lable);
}
ENSURE(pAxisX);
for (CGraphSerieVector::iterator it2 = it1->m_series.begin(); it2 != it1->m_series.end(); it2++)
{
//****************
//Y
CChartCtrl::EAxisPos axis = it2->m_YAxis == 0 ? CChartCtrl::LeftAxis : CChartCtrl::RightAxis;
CChartAxis* pAxisY = pChart->GetAxis(axis);
if (pAxisY == NULL)
{
pAxisY = pChart->CreateStandardAxis(axis);
pAxisY->SetAutomatic(true);
pAxisY->SetPanZoomEnabled(false);
pAxisY->EnableScrollBar(false);
pAxisY->SetAutoHideScrollBar(false);
TChartString lable = ToUTF16((it2->m_YAxis == 0) ? it1->m_Ytitle1 : it1->m_Ytitle2);
pAxisY->GetLabel()->SetText(lable);
//if (it2->m_YAxis == 1)
//pAxisY->GetGrid()->SetVisible(false);
}
ENSURE(pAxisY);
//****************