Пример #1
0
GraphControl::GraphControl() :
    GG::Control(GG::X0, GG::Y0, GG::X1, GG::Y1, GG::NO_WND_FLAGS),
    m_show_points(true),
    m_show_lines(true),
    m_show_scale(true),
    m_x_min(0.0),
    m_x_max(0.0),
    m_y_min(1.0),
    m_y_max(1.0),
    m_data(),
    m_vert_buf(),
    m_colour_buf(),
    m_x_scale_ticks(),
    m_y_scale_ticks()
{
    std::vector<std::pair<double, double> > test_data;
    test_data.push_back(std::make_pair(0.0, 1.0));
    test_data.push_back(std::make_pair(1.0, 3.2));
    test_data.push_back(std::make_pair(4.2, -1));
    test_data.push_back(std::make_pair(0, 0));
    test_data.push_back(std::make_pair(-1, 1));
    m_data.push_back(std::make_pair(test_data, GG::CLR_CYAN));

    test_data.clear();
    test_data.push_back(std::make_pair(1.0, 1.0));
    test_data.push_back(std::make_pair(2.0, 3.2));
    test_data.push_back(std::make_pair(3.2, -1));
    test_data.push_back(std::make_pair(4, 0));
    test_data.push_back(std::make_pair(5, 1));
    m_data.push_back(std::make_pair(test_data, GG::CLR_YELLOW));

    AutoSetRange();
}
Пример #2
0
GraphControl::GraphControl() :
    GG::Control(GG::X0, GG::Y0, GG::X1, GG::Y1, GG::NO_WND_FLAGS),
    m_show_points(true),
    m_show_lines(true),
    m_show_scale(true),
    m_x_min(0.0),
    m_x_max(0.0),
    m_y_min(1.0),
    m_y_max(1.0),
    m_data(),
    m_vert_buf(),
    m_colour_buf(),
    m_x_scale_ticks(),
    m_y_scale_ticks()
{
    std::vector<std::pair<double, double>> test_data = {{0.0, 1.0}, {1.0, 3.2}, {4.2, -1}, {0, 0}, {-1, 1}};
    m_data.push_back({test_data, GG::CLR_CYAN});

    test_data = {{1.0, 1.0}, {2.0, 3.2}, {3.2, -1}, {4, 0}, {5, 1}};
    m_data.push_back({test_data, GG::CLR_YELLOW});

    AutoSetRange();
}