예제)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
function(chartData) {
    Highcharts.chart('monitoringDonutChart', {
        credits: {
            enabled: false,
            position: {
                align: 'center',
                verticalAlign: 'middle'
            }
        },
        chart: {
            height: 250,
            width: 300,
            marginTop:  null,
            margin: null,
            animation: true,
            events: {
                load: function() {
                    var chart = this,
                    value = 0;
                    chart.series[0].yData.forEach(function(point, index) {
                        if(index == 0){
                            value += point;
                        }
                    });
                    
                    //파이챠트 중간에 텍스트 추가 후 상,하 센터정렬
                    chart.renderer.text(value, nullnull, chart.resetZoom, {
                        }).attr({
                           align: 'center',
                           verticalAlign: 'middle'
                        }).add().css({fontSize: '20px'}).align({
                           align: 'center',
                           verticalAlign: 'middle',
                           x: 0,
                           y: 0
                        }, falsenull);
                    
                }
            }
        },
        title: { 
            enabled: false,
            useHTML:true,
            text: null,
            verticalAlign: 'bottom'
        },
        plotOptions: {
            pie: {
                dataLabels: {
                    enabled: false
                },
                animation: false,
                showInLegend: true
            },
        },
        legend: {
            enabled: false
        },
        series: [{
            name'사용량',
            type: 'pie',
            innerSize: '75%',
            colors: ['#ffcc00''#c0c0c0'],
            data: chartData
        }, ],
    });
}
cs

 

참고)

- 도넛형태 : stackoverflow.com/questions/54434360/aligning-labels-in-highchart-donut

 

Aligning labels in highchart donut

I'm trying to make a highchart donut with a legend on the side, I'm really struggling to get the data labels to be more centered. At the moment each of them are in a different place, an image of

stackoverflow.com

- 중간에 텍스트삽입 : stackoverflow.com/questions/38072913/how-to-add-text-via-chart-renderer-text-in-highcharts

 

How to add text via chart.renderer.text in Highcharts?

I have succeeded adding additional text to my charts, like here. This, I achieved through adding a "function(chart)" to my "var chart = new Highcharts.Chart" $.get('xxx.csv', function(data) { ...

stackoverflow.com

 

- 가운데 정렬 : stackoverflow.com/questions/22310677/add-buttons-in-chart-of-highcharts-at-runtime

 

Add buttons in chart of Highcharts at runtime

I need to add some custom buttons (with onclick events), without overwrite the exporting buttons value, 'cause I wanna include new buttons without lost the custom buttons previously defined in cha...

stackoverflow.com

 

 

Posted by 셋부터넷
,

어느날 아래와 같은 구조를  가진 테이블을

 idx

area1 

area2 

area3 

area4 

area5 

 1

 10

20 

30 

40 

50 

 2

 11

21 

31 

41 

51 

 

 

아래와 같이 변경 해야 하는 경우가 닥치고 말았다

no

position 

value 

 1

 area1

 10

 1

 area2

 20

 1

 area3

 30

 1

 area4

 40

 1

 area5

 50

 2

 area1

 11

 2

 area2

 21

 2

 area3

 31

 2

 area4

 41

 2

 area5

 51

 

해결책 :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
SELECT
    `no`,
    CASE 
        WHEN x=1 THEN 'area1'
        WHEN x=2 THEN 'area2'
        WHEN x=3 THEN 'area3'
        WHEN x=4 THEN 'area4'
        WHEN x=5 THEN 'area5'
    END `position`,
 
    CASE 
        WHEN x=1 THEN area1
        WHEN x=2 THEN area2
        WHEN x=3 THEN area3
        WHEN x=4 THEN area4
        WHEN x=5 THEN area5
    END `value
FROM (
    select * from default_data a,
    (
        select 1 AS x
        union all select 2 AS x
        union all select 3 AS x
        union all select 4 AS x
        union all select 5 AS x
    ) b
)
ORDER BY `NO`, `NUMBERS` ASC;
cs

 

[출처] Mysql 가로 컬럼 형태를 세로 rows 형태 로 변경|작성자 RS

Posted by 셋부터넷
,

Spring Security 설정 후 로그인을 해보면 아이디나 비밀번호가 틀려도 모두 BadCredentialException만 발생해서 두 가지 에러상황을 따로 처리할 수 없다. 해당 이슈를 구분할 수 있는 setHideUserNotFoundException설정이 기본 true로 설정되어있어 그렇다고한다. 더 강한 보안을 위해서 그렇다고 하는데 잘 이해가 안간다... 

 

암튼 이 설정값은 AuthenticationProvider 생성 시에 false로 수정할 수 있다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
@Bean
public DaoAuthenticationProvider daoAuthenticationProvider() {
    DaoAuthenticationProvider bean = new DaoAuthenticationProvider();
    bean.setHideUserNotFoundExceptions(false);
    bean.setUserDetailsService(userDetailsService);
    bean.setPasswordEncoder(passwordEncoder());
    
    return bean;
}
 
@Override 
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth.authenticationProvider(this.daoAuthenticationProvider());
}
cs

Security Config 설정파일에서 AuthenticationProvider 생성 시 해당 값을 false로 지정한 뒤 적용한다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
@Override
public void onAuthenticationFailure(
    HttpServletRequest request, 
    HttpServletResponse response, 
    AuthenticationException e) throws IOException, ServletException {
 
    String sErrMsg = "";
    if (e instanceof UsernameNotFoundException) {
        sErrMsg = "존재하지 않는 사용자입니다.";
    } else if (e instanceof BadCredentialsException) {
        sErrMsg = "비밀번호가 틀립니다.";
    } else {
        sErrMsg = "기타 인증오류입니다.";
    }
    
    ...
}
cs

AuthenticationFailureHandler를 구현한 핸들러에서 UsernameNotFoundException을 처리할 수 있다.

 

참고)

cyr9210.github.io/2019/09/30/Security/usernamenotfound/

 

인증 시, UsernameNotfoundException 발생 안함 문제(BadCredentials Exception만 발생)

SpringSecurityDebug인증 시, UsernameNotfoundException 발생 안함 문제(BadCredentials Exception만 발생)

cyr9210.github.io

www.programmersought.com/article/8509702354/

 

2019-01-10 springboot + spring-security The error message when logging in is "Bad Credential" instead of specific information...

In the background, if the username is incorrectly logged in, there is a specific error exception message returned. But in the front-end interface, I only saw "Bad Credential" instead of specific error messages. Keep track of the code and find the problem h

www.programmersought.com

codevang.tistory.com/268

 

스프링 Security_로그인_로그인 실패 대응 로직 [3/9]

- Develop OS : Windows10 Ent, 64bit - WEB/WAS Server : Tomcat v9.0 - DBMS : MySQL 5.7.29 for Linux (Docker) - Language : JAVA 1.8 (JDK 1.8) - Framwork : Spring 3.1.1 Release - Build Tool : Maven 3.6..

codevang.tistory.com

 

Posted by 셋부터넷
,